Displaying a DSN connection name

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
 
A

Aaron Kempf

you should just use Access Data Projects instead of maknig DSN

ADP is _ALWAYS_ faster and more stable / reliable than MDB
 
M

Maurice

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
 
D

DJJ

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))
 
M

Maurice

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

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

Top