Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a DB file from a user interface control button

Status
Not open for further replies.

tbiceps

IS-IT--Management
Nov 23, 2005
106
0
0
US
I have listed the code for a form I built in Access. When the control button is pressed, the database file should open. This code works in Word, but it doesn't work when I use it in Access. The Sub (Access.Private Sub Command10_Click()), is where this event should take place, but I get the following error, "Runtime error '424' Object Required." What am I missing?


Option Compare Database

Private Sub Command1_Click()
On Error GoTo Err_Command1_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "mainFRM"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click

End Sub

Private Sub Command10_Click()
ActiveDocument.FollowHyperlink "F:\FUNCTIONAL_USERS\WMS DATABASE REPORT REPOSITORY\EXCEED_WMS_TABLE1.mdb", , True
End Sub
 
Access doesn't have an ActiveDocument object, Substitute with Application.

Roy-Vidar
 
ACcess does not have an 'Activedocument'.
Use Application instead.
 
You are wonderful! Thanks for expert guidance. My program now works. Great VBA exercise.
 
If you recal tbiceps, this is what i told you in your original post. :)



-Pete
 
That's true. It worked in Word, but not in ACCESS. I confused my understanding, but everyone here has gotten me straight.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top