Find the name of the sql database I'm connected to

  • Thread starter Thread starter Hallgeir
  • Start date Start date
H

Hallgeir

In a txt box in my form I want to show the name of the sql server database
my tables are linked to. I guess there is some way to code this in the forms
open event, but I can't find the syntax to get the database name.
Appreciate any suggestion.
 
hi,
In a txt box in my form I want to show the name of the sql server database
my tables are linked to. I guess there is some way to code this in the forms
open event, but I can't find the syntax to get the database name.
You can extract it from the connect string, enter the following in the
immediate window:

?CurrentDb.TableDefs.Item("LinkedTable").Connect

Depending on your connect string you have to extract the CATALOG= or
DATABASE= part.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top