Open object in another database

A

Alex

I have a combo box in a form where a user chooses another database and object
he/she would like to open. Using the code below, I can get the other
database open, but I'm not sure how to write the code to in turn open an
object in the newly opened database. The objects might be a report, form,
etc. Any help is much appreciated. Thanks.

Private Sub ChooseDB_Click()
Dim mypath As String
Dim myobject As String

mypath = Me.txtPath
myobject = Me.txtObject

Application.FollowHyperlink mypath

mypath.openobject.myobject ---------not working

End Sub
 
G

Gina Whipp

Alex,

Not working because you've only told it to, in essence, go to MyPath. You
didn't tell it what to do when it got there. Try...

Private Sub ChooseDB_Click()
Dim mypath As String
Dim myobject As String

mypath = Me.txtPath
myobject = Me.txtObject

Application.FollowHyperlink (mypath & myobject)

End Sub


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
A

Alex

Thank you Gina, I'm sure this will work great.

Gina Whipp said:
Alex,

Not working because you've only told it to, in essence, go to MyPath. You
didn't tell it what to do when it got there. Try...

Private Sub ChooseDB_Click()
Dim mypath As String
Dim myobject As String

mypath = Me.txtPath
myobject = Me.txtObject

Application.FollowHyperlink (mypath & myobject)

End Sub


--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
A

Alex

Gina, I just tried your suggestion and it's not working. I'm sure that
Me.txtObject is the correct name of the form control and that the name in
Me.txtObject is the name of the object in the other db I need to open. Any
ideas why it's not working? Thanks for your help.

Private Sub ChooseDB_Click()
Dim mypath As String
Dim myobject As String

mypath = Me.txtPath
myobject = Me.txtObject

Application.FollowHyperlink mypath & myobject
 
A

Alex

txtPath is the path of the db to open C:\mydocuments . . .
txtObject is the name of the report in the database specified in txtPath
that I need to open
 
G

Gina Whipp

Alex,

Did you create this folder because My Documents folder is: C:\Documents and
Settings\Regina Whipp\My Documents\

So did you create a C:\MyDocuments? AND am I undertanding you want to open
a report in another Access database? If yes, what are you putting in the
txtObject? Just the name of the report?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 

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

database exclusive use by Admin 5
Access 2003 Error 2749 3
forms Coding 6
How to fix Run/time error 438 1
Open CSV File 4
storing photos in database 1
Run-time error 2777 0
followhyperlink error 1

Top