473,804 Members | 4,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

object not defined/odbc with msaccess

11 New Member
hi

i 'm writng a code using msaccess with odbc.
my dsn name is htgry
i want to insert data eneterd in text fields to a table named qwer on clicking a command button.

code as follows

Private Sub Command14_Click ()


Dim dbLocation 'Location of our Access database file
Dim sSQL 'Our SQL query

dbLocation = "C:\Documen ts and Settings\Admini strator\Desktop "
Set objADO = dbLocation.Crea teObject("ADODB .Connection") 'Create an ADO connection to a database //// line1

objADO.Open "htgry" //// line2
objADO.Open dbLocation 'Open the database
sSQL = "INSERT INTO qwer ( name , amount ) VALUES('" & Text7 & "' , '" & Text9 & "')" 'Set our SQL query
objADO.Execute (sSQL) 'Execute this SQL query


objADO.Close
Set objADO = Nothing

End Sub

it is not being executed and error is "object not defined " at line 1 and line 2

kindly make me complete this programme error free.
with anticipation
Nov 24 '06 #1
6 2350
MMcCarthy
14,534 Recognized Expert Moderator MVP
The syntax for creating DSN connections is as follows:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Dim conConnector As ADODB.Connection
  4.  
  5.     Set conConnector = New ADODB.Connection
  6.  
  7.     conConnector.Open "DSN=htgry;UID=UserName;PWD=Password;"
  8.  
  9.     conConnector.Close
  10.     Set conConnector = Nothing
  11.  
  12.  
  13.  
Nov 25 '06 #2
odbcmsaccess
11 New Member
ihav euse dyour code
following error occured
run time error 2147467259(8000 4005)
[Microsoft]ODBC microsoft access driver] the database has been placed in a state by an unknown user that prevents it from being opened or locked
dsn
code:

Dim dbLocation 'Location of our Access database file
Dim sSQL 'Our SQL query
Dim conConnector As ADODB.Connectio n

Set conConnector = New ADODB.Connectio n

conConnector.Op en "DSN=htgry;UID= UserName;PWD=Pa ssword;"
dbLocation = "C:\Documen ts and Settings\Admini strator\Desktop \dbd"
conConnector.Op en dbLocation
sSQL = "INSERT INTO Table1 ( name , amount ) VALUES('" & Text7 & "' , '" & Text9 & "')" 'Set our SQL query
conConnector.Ex ecute (sSQL) 'Execute this SQL query
conConnector.Cl ose
Set conConnector = Nothing

what is password, userid?
hoping reply



The syntax for creating DSN connections is as follows:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Dim conConnector As ADODB.Connection
  4.  
  5.     Set conConnector = New ADODB.Connection
  6.  
  7.     conConnector.Open "DSN=htgry;UID=UserName;PWD=Password;"
  8.  
  9.     conConnector.Close
  10.     Set conConnector = Nothing
  11.  
  12.  
  13.  
Nov 27 '06 #3
odbcmsaccess
11 New Member
ihav euse dyour code
following error occured
run time error 2147467259(8000 4005)
[Microsoft]ODBC microsoft access driver] the database has been placed in a state by an unknown user that prevents it from being opened or locked
dsn htgry, filename dbd, table name Table1.
code:

Dim dbLocation 'Location of our Access database file
Dim sSQL 'Our SQL query
Dim conConnector As ADODB.Connectio n

Set conConnector = New ADODB.Connectio n

conConnector.Op en "DSN=htgry;UID= UserName;PWD=Pa ssword;"
dbLocation = "C:\Documen ts and Settings\Admini strator\Desktop \dbd"
conConnector.Op en dbLocation
sSQL = "INSERT INTO Table1 ( name , amount ) VALUES('" & Text7 & "' , '" & Text9 & "')" 'Set our SQL query
conConnector.Ex ecute (sSQL) 'Execute this SQL query
conConnector.Cl ose
Set conConnector = Nothing

what is password, userid?
hoping reply



The syntax for creating DSN connections is as follows:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Dim conConnector As ADODB.Connection
  4.  
  5.     Set conConnector = New ADODB.Connection
  6.  
  7.     conConnector.Open "DSN=htgry;UID=UserName;PWD=Password;"
  8.  
  9.     conConnector.Close
  10.     Set conConnector = Nothing
  11.  
  12.  
  13.  
Nov 27 '06 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
You said you created a DSN to another database. Does that database have a userid and password? If not then just put "DSN=htgry; "
Nov 27 '06 #5
odbcmsaccess
11 New Member
hello

i used ur code
error: not a valid password
wat is password and how to overcome this error

pls reply

The syntax for creating DSN connections is as follows:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Dim conConnector As ADODB.Connection
  4.  
  5.     Set conConnector = New ADODB.Connection
  6.  
  7.     conConnector.Open "DSN=htgry;UID=UserName;PWD=Password;"
  8.  
  9.     conConnector.Close
  10.     Set conConnector = Nothing
  11.  
  12.  
  13.  
Dec 8 '06 #6
NeoPa
32,579 Recognized Expert Moderator MVP
hello

i used ur code
error: not a valid password
wat is password and how to overcome this error

pls reply
It sounds like you need to have a word with your IT department.
Ask them to explain this concept to you and give you the details you need to access via this DSN.
Dec 8 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1386
by: Kong Li | last post by:
Follow up to this thread, the latest Oracle 9i release 2 patchset (9.2.0.5) fixed the handle count leak problem. The problem is in Oracle client component. Thanks. Kong ----- From: Kong Li (likong@email.com)
0
5008
by: Fatt Shin | last post by:
Hi, I'm running MySQL 4.0.13, connecting from PowerBuilder 9 using ODCB Connector 3.51. I'm facing a problem where whenever I issue a SELECT COUNT(*) statement from PowerBuilder, I always get SQL syntax error back from MySQL. (Refer to ODBC Trace I captured below). metrohouse af8-b94 ENTER SQLExecDirect HSTMT 014D2360 UCHAR * 0x020A0EA2 "select count ( *) from code
1
1134
by: David Codding | last post by:
I am using ODBC 4.51 and mySQL 4.0.1-NT. I have an app that is written in vb6 with msAccess 2000 that was converted to mySQL. Everything is working great except for one thing. I have a grid of information (using TrueGrid v7) and I need the grid to update with the newest data. In msAccess (ADO) I used the adUseServer Cursor / Dynamic Recordset and then all I had to do was do a tdbgrid1.refresh to get the latest data. Everything was...
2
4940
by: Len Kowalik | last post by:
MSAccess 2000, SQL-Server 97 I am getting a permission denied response from an attempt to execute a stored proc, which has public access revoked and app role access, on the last statement of the following code: ---------------------------------------------------------------------- strAttributes = "DATABASE=User_ProfilesQual" & _ vbCr & "Description=Default logon DB" & _ vbCr & "OemToAnsi=No" & _
6
18720
by: Andi Reisenhofer | last post by:
Hallo C# folks, Somebody know how to create a ODBC DSN dynamically in c# program. Also interesting for me would be the connectionstring for an Access Database. Thinks a lot Andreas
0
5032
by: Lewt | last post by:
I am aware of the 'hack the registry' approach. This is just not a safe way to accomplish this on a user's PC. I need to do this the right way. Is there anyone -perhaps from Microsoft - out there who can assist me on this? "Colin Stutley" wrote: > I now see your dilemma. > > Not sure of the appropiate API calls, but an alternative may be to simple > add the appropiate registry entries for the DSN. I would try; > 1) Export your...
2
1872
by: mvl_groups_user | last post by:
I am trying to look up data on about 1000 records from a 6 million record view on a DB2 database using msaccess. The 6 million record DB2 view is connected through a linked ODBC table (table A), and the 1000 primary key numbers I want are in a local msaccess table (table B). The most obvious solution is to join table A and B, but this is excruciatingly slow performance-wise.
0
1380
by: Sweden | last post by:
We would like to create an ODBC link or OLEDB link using MsAccess.Mdb to obtain individual table details from Accpac Plus in Dos (an accounting program)? The database has Modules such as AP, AR +++ each of which has 6 to 9 individual tables. This Access data will be used for viewing and printing and not for accounting purposes. Can we receive any ideas or a sample database of how to do this? Thank you Mehran
4
6485
by: Rodent | last post by:
I have an IIS 6.0, 2003 Server running with PHP installed. I have an access database with a DSN ODBC connection configured. When this ODBC is configured to access the database locally - great, works fine. When configured to access a remote copy of this database I get the following : "....Warning: odbc_connect() : SQL error:
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.