|
 |
access thread: Re: GetCurrentDB function
Message #1 by "Mavin Specimen" <mspecimen@h...> on Mon, 24 Sep 2001 19:29:25
|
|
Hi I am trying to convert an Access mdb to an Access Project. In on of the modules is a function to get
the name of the current db. I am confused on how to convert this so it can be used in a Project; of course the back end is MS SQL.
Here is the code for the function:
'Public Function GetCurrentDB() As DAO.Database
On Error Resume Next
'Returns reference to current database, even if variables are reset
Static db As DAO.Database
On Error Resume Next
strName = db.Name
If Err.Number <> 0 Then
Set db = CurrentDb()
'End If
Set GetCurrentDB = db Function
End Function
Thoughts/Comments.
Thanks
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 24 Sep 2001 12:58:31 -0700
|
|
You may not need a function at all--CurrentProject.Name returns the filename
of the current project. Maybe that will get you what you need?
Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
(xxx) xxx-xxxx
-----Original Message-----
From: Mavin Specimen [mailto:mspecimen@h...]
Sent: Monday, September 24, 2001 12:28 PM
To: Access
Subject: [access] Re: GetCurrentDB function
Hi I am trying to convert an Access mdb to an Access Project. In on of the
modules is a function to get the name of the current db. I am confused on
how to convert this so it can be used in a Project; of course the back end
is MS SQL. Here is the code for the function:
'Public Function GetCurrentDB() As DAO.Database
On Error Resume Next
'Returns reference to current database, even if variables are reset
Static db As DAO.Database
On Error Resume Next
strName = db.Name
If Err.Number <> 0 Then
Set db = CurrentDb()
'End If
Set GetCurrentDB = db Function
End Function
Thoughts/Comments.
Thanks
|
|
 |