R
Raul Sousa
I need when closing a form to open a report on a specific record.
So, I have this code:
Private Sub Form_close()
DoCmd.OpenReport "Invoice", acViewPreview, , "[DocId] = """ & Me.[DocID]
& """", acNormal
End Sub
The problem is that it opens the report always on the first record, no
matter which DocId I have.
If I run the code without closing the form it works fine.
I guess that the Form_close() event runs the code after closing the form and
so Me.DocId is Null.
Is there any way for running the code before closing the form?
So, I have this code:
Private Sub Form_close()
DoCmd.OpenReport "Invoice", acViewPreview, , "[DocId] = """ & Me.[DocID]
& """", acNormal
End Sub
The problem is that it opens the report always on the first record, no
matter which DocId I have.
If I run the code without closing the form it works fine.
I guess that the Form_close() event runs the code after closing the form and
so Me.DocId is Null.
Is there any way for running the code before closing the form?