OpenArgs Arrgh!

groengoen

Registered User.
Local time
Today, 16:39
Joined
Oct 22, 2005
Messages
141
I have tried to pass on a string to a new form using the OpenArgs, but, being new to all this, am unable to see what is wrong with the syntax. This is the code for the open:

Private Sub cmdTask_Click()
DoCmd.OpenForm stDocName, acNormal, , , , , "new"
End Sub


and this is the code where I wanted to see what I had:

Private Sub Form_Open(Cancel As Integer)
Dim stOpenArgs As String

stOpenArgs = Me.OpenArgs

MsgBox stOpenArgs

End Sub


When I do the Form_Open the form doesn't even open, but if I remove the code it opens fine, so there is a syntax error. I know that the answer is probably something very simple, but it continues to elude me. Help!
 
Where are you supposed to be getting stDocName?
 
Try it in the Form_Load event.
 
Sorry, you're right. I left out the lines

Dim stDocName As String
stDocName = "frmTask"

using the FormLoad event worked! Thanks a lot
 

Users who are viewing this thread

Back
Top Bottom