Open object in another database

  • Thread starter Thread starter Alex
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
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
 
Back
Top