Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Connection in vb

Status
Not open for further replies.

barbs2

Technical User
Jan 24, 2003
8
IE
I am using the following connection in VB to connect to an access db:

cn.Open ("Provider=Microsoft.jet.oledb.4.0;" & _
"Data Source=" & App.Path & "\db1.mdb")

However I am getting a runtime error saying that it cannot find the file but it also states the path to the file. Why can it know the path but not find the file?
 
That's because you supplied it that path. It states it can't find the path you supplied.
Greetings,
Rick
 
Put a MsgBox statement right above the cn.Open statement.
Like so:

MsgBox App.Path & "\db1.mdb"

See what it returns. It might be that the path is invalid and therefor generates the error.
I've been told that App.Path does not allways returns the correct pathname. Just debug it with a messagebox and you'll know more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top