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

When trying to connect two databases on different servers

Status
Not open for further replies.

beer

Programmer
Mar 13, 2001
19
US
Hello All,

Something very strange happened in my code.

The goal of my code is to connect two different databases on different servers.

The Connection String of a database is coming from a table in another database.

Therefore, what I did is something like:

Set Conn = CreateObject("ADODB.Connection")
ConnString = rs("ConnString")
Conn.Open ConnString

Then, I got the "Data Source Name not found....." error.

However, when I plug in the written ConnString instead of a variable in the Conn.Open part and it works.

What I stored in the ConnString is something like:
"DRIVER=Microsoft Access Driver (*.mdb);DBQ=\\servername\database.mdb"

It works if I put the whole string in the open connection command while I can't use the variable. WHY?

PLEASE HELP!

Thank you very much,
Beer

 
Oh Well, I figured that out already. Sorry about that.

What I did is to take out the quotes out of the database. I guess when using variable in open connection command, we dont' need to use the quotes around it while typing in the while string quotes are required.

Good, today I learn something again.

Thank you,
Beer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top