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!

Querying which SQL database being used in ODBC

Status
Not open for further replies.

dbarnard

MIS
Sep 30, 2002
5
GB
Hi,

I am using Access 2007 to connect to one of two SQL databases via ODBC. One is our live database on a network server and the other is the test database (stored at the moment on my laptop). Both SQL databases are using either SQL 2005 or SQL 2005 Express.

My problem is trying to write some VBA to query which of the 2 servers is being used at the time so that I can display the server name on the initial Access form.

Any idea's on how to do this?

Thanks
Dean
 
Not sure about Access but in Excel, any ODBC setup has a CONNECTION property that should give you what you want - would be very surprised if Access doesn't have similar for linked tables..

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Hi Geoff,

Thanks for the response, but as we are using the User DSN it does not seem to return the server it is connected to. I've managed to get round it by doing a WSHShell.regread on the relevant registry key.

Regards
Dean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top