Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to open the Data file one time ?
Message
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00362527
Message ID:
00365739
Views:
58
>>>Yes.. but the problem solved when i made a data link connection.
>>>but now it is giving error on the .Open line as follow:
>>>
>>>Public Sub main()
>>> 'This will open a global connection
>>> Set gobjconn = New ADODB.connectoin
>>> With gobjconn
>>> ' Change the data source properth in the following time
>>> .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\mysystems\res\res-test.mdb;Persist Security Info=False"
>>> .Open <<<<==========
>>> End With
>>>
>>> ' Now that the connection is open, display the application
>>> Form1.Show
>>>
>>>Error Expr.
>>>Runtime error 3709
>>>the application requested an operation on an object with reference to a closed or invaled connection object.
>>
>>Is this a copy-and-paste from your application? If so, you have a serious typo error:
Set gobjconn = New ADODB.connectoin
>>Should read
Set gobjconn = New ADODB.connection
>>
>>Also, you may want to try to set your provider to "Provider=Microsoft.Jet.OLEDB.3.51;"
>
>Do you beleve it, i checked the code for more than 100 times !!!! :))))
>no it is not copy-past, i retyped it tring understand the code to wrote...
>this is a common problem we face it to much in the developing time, and somtimes we spend days to find out a problem while it is in front of us but we dont see it. :)
>
>- why to use 3.51 insted of 4.0.?
>
>- do i have to type the ubove code in each form i open, and what is the best way to refere
>each txtbox in the form to the correct field in the table.
>
You can create a connection and store it in a global variable (public variable in a standard module) and then use this connection anywhere you need it.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform