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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the ADO database path at run time

Status
Not open for further replies.

Lynus

Technical User
Apr 12, 2003
69
Please help. I have an application where I want to set the ADO database paths at run time. I have the ADO objects on the app with no connection string. Then as the form loads I try to set the connection string and recorset. The database will be with the program executable when it installs.
Here is the code

Private Sub Form_Load()
Dim mypath As String
mypath = App.Path
Dim dbconnect As String

dbconnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + mypath + "\BugDB.mdb;Persist Security Info=False"
Adodc1.ConnectionString = dbconnect
Adodc1.RecordSource = "Bugs"

When I run the app I get an error : "Data source name not found and no default driver specified" I cant figure out what I am doing wrong. Please help!
 
Replace + with & and see if you have jet 4.0 installed on your computer.
 
Hi Guys. First of all thank you very much for your responses they were very quick. This was my first post to a programming BB and I am very surprised by how quick the responses came in.You people ROCK!

My apologies for the duplicate post VBOldTimer. I wasn't sure where to post it. I found this forum after I had already posted to the original forum so I figured I would cover all my bases.

I changed the "+" to "&". Thanks for the tip.

I also found my problem. I cleaned out the connection string but forgot yo change the recordsource. The object was still pointing to a table. Which logically makes sense.

So I fixed it. But thanks for the speedy replys and I am sure you will see more of me around.

~Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top