PDA

Click to See Complete Forum and Search --> : ADO Data Control Connection to Access97


rockies1
Jul 20th, 1999, 08:30 PM
I am trying to connect my VB app to an Access 97 db, A:\Elements.dat.

My code is this:

Dim strTemp
strTemp = App.Path
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source = " & strTemp & "Elements.dat"
Adodc1.RecordSource = "Elements"
Adodc1.CursorType = adOpenStatic

When I try to connect, I get no errors, but no connection, either...

My app & my DB are in the same directory. The DB is named with an extension of .DAT to keep users from snooping. I've tested the name thing with another app & it worked fine...

I'm stumped. Any ideas?

Thanks!!

My work E-mail has been tempermental lately, so please feel free to use rockies1@gvi.net Thanks!!

Also, the only reason I'm trying to connect this way, rather than at design time is that I am unsure where the user will install and want to be flexible...If you know how to code it for a design-time connection, and allow user to install wherever they want, please let me know.


[This message has been edited by rockies1 (edited 07-21-1999).]

preeti
Jul 21st, 1999, 12:14 AM
Hi,

Try using:

Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source = " & strTemp & "\Elements.dat"

You are missing a backslash in your path.

HTH,

Preeti

rockies1
Jul 21st, 1999, 12:24 AM
I got so frustrated over what I would consider a simple problem, I changed over to a standard data control. When it still didn't work I used your suggestion and it worked!!

One thing I found...If it is installed at the root of a drive, it didn't need the \ but if it wasn't at the root, it did.

I went around it like this:

If Right(App.Path, 1) = "\" Then
Data1.DatabaseName = App.Path & "Elements.dat"
Else
Data1.DatabaseName = App.Path & "\Elements.dat"
End If

Thanks for the help!!

PS: What is the difference between Member and Junior Member here?

preeti
Jul 21st, 1999, 12:46 AM
I have no idea and I am trying to figure out when I became a member :)