MS Access VBA - somehow not getting OpenArgs passed, always NULL

324 views Asked by At

This seems like a really simple thing to do, and I believe I'm coding it correctly - but I get me.openargs as NULL for some reason.

Calling code in a button click event on form1:

Private Sub Command0_Click()

    DoCmd.OpenForm "frmGetLetter", , , , , , "CA14-09"

End Sub

Form Open event on the called code:

Private Sub Form_Open(Cancel As Integer)

If Not IsNull(Me.OpenArgs) Then
    strLetterName = Me.OpenArgs
Else
    strLetterName = "MISC-02"
End If

me.Openargs is always NULL - what am I missing here?

1

There are 1 answers

0
Andrew Jennings On

As Erik A and June7 suspected, I had the form I was calling already open. Everything works as expected if I DoCmd.Openform without it being opened previously.

Many thanks!