openargs is null at called form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In access 2003, I'm opening a form using the docmd.openform command and
passing a long integer value to the called form. In debug mode, the value of
the openargs parameter is correct. When I try to use the value in the called
form, like lngValue = me.openargs, the value of openargs shows up as null. I
just switched to 2003 from XP, and I don't recall seeing this problem before.
 
Any chance the form is already open when you OpenForm with the OpenArgs?

If so, it retains the OpenArgs from when it was acutally opened.
You may need to test like this:
Dim strDoc as String
strDoc = "Form1"
If CurrentProject.AllForms(strDoc).IsLoaded Then
with Forms(strDoc)
If .Dirty Then .Dirty = False
DoCmd.Close acForm, strDoc
End With
End If
DoCmd.OpenForm strDoc, OpenArgs:="99"
 
I had the called form open in design view. By closing it entirely, the code
started working ok. Thanks for the suggestion
 
Back
Top