Opendatabase with variable

J

jokobe

Hi ng,

I'm using this code:
Set db = DBEngine.Workspaces(0).OpenDatabase("any")

Instead of the any string, I would like to have
a variable containing the actual path for the
database like this:

act_path = "c:\somewhere\my_db.mdb"
But, the opendatabase method doesn't seem to accept
the act_path variable.

Any helpfull hint??

Thanks in advance

jokobe
 
A

Allen Browne

Try:
Dim db As DAO.Database
Set db = OpenDatabase(act_path)
'useful stuff
db.Close
Set db = Nothing
 
G

Guest

Thanks Allen,

it is working.

Joe
-----Original Message-----
Try:
Dim db As DAO.Database
Set db = OpenDatabase(act_path)
'useful stuff
db.Close
Set db = Nothing

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 

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

Similar Threads

OpenDatabase errors 1
OpenDatabase 2
OpenDatabase/OpenConnection commands 6
OpenDatabase Problem in VB 2
About Sub Main( ) 5
>> Open another database 4
Removing field programmatically 2
DMin external database 3

Top