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

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.
 
S

Stefan Hoffmann

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 <--
 
Top