Displaying a DSN connection name

  • Thread starter Thread starter DJJ
  • Start date Start date
D

DJJ

I have an Access2003 database that can connect to data stored locally or on
a server using odbc dsn names.

I would like to display in a label field the current dsn name so the user
knows if he or she is connected to local data or server.data.

I cannot find a property that will list the DSN name. The
BaseConnectionString property makes no mention of the DSN name in its string
output.

Thx

DJJ
 
you should just use Access Data Projects instead of maknig DSN

ADP is _ALWAYS_ faster and more stable / reliable than MDB
 
You state that the Data can be stored locally or via DSN. My guess is that
you should supply the DSN name anyhow otherwise the DB doesn't know which one
to use. If you do know the DSN name you can provide it yourself by placing it
in a textbox.

Maurice
 
Maurice said:
You state that the Data can be stored locally or via DSN. My guess is that
you should supply the DSN name anyhow otherwise the DB doesn't know which
one
to use. If you do know the DSN name you can provide it yourself by placing
it
in a textbox.

Maurice

I was able to find the code. The following displays the DSN name when
pasted into an expression for an unbounded field or label.

=Mid(CStr(CurrentDb.TableDefs("anytable").[Connect]),10,(InStr(9,CStr(CurrentDb.TableDefs("anytable").[Connect]),";",1)-10))
 
Great, thanks for posting your answer that really helps others too.

Maurice

DJJ said:
Maurice said:
You state that the Data can be stored locally or via DSN. My guess is that
you should supply the DSN name anyhow otherwise the DB doesn't know which
one
to use. If you do know the DSN name you can provide it yourself by placing
it
in a textbox.

Maurice

I was able to find the code. The following displays the DSN name when
pasted into an expression for an unbounded field or label.

=Mid(CStr(CurrentDb.TableDefs("anytable").[Connect]),10,(InStr(9,CStr(CurrentDb.TableDefs("anytable").[Connect]),";",1)-10))
 
Back
Top