Me.OpenArgs

G

Guest

I am trying to use a popup form for entering and displaying data, I have a
button on a parent form I can open the popup with and enter data but the key
field is not updated so when I re-open the form the records are no longer
there they are in the table with no matching key, an old database I put
togather long ago had the following code and when I run it this way I get
Invalid use of Null from OpenArgs

Option Compare Database
Dim txtStudentID As String

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty = True Then
Me![strStudentID] = txtStudentID
End If
End Sub

Private Sub Form_Load()
txtStudentID = Me.OpenArgs
End Sub

Anyone know what is wrong, I would appriciate any help
 
B

Brian Bastl

David,

If Not IsNull(Me.OpenArgs) Then
me.txtStudentID = Me.OpenArgs
End If

HTH,
Brian
 
G

Guest

Thank you Brian but I have found the problem, I did not pass the OpenArgs on
to the popup, I have corrected it and it works fine now

DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me![strStudentID]

Thanks Again
David C. Widener


Brian Bastl said:
David,

If Not IsNull(Me.OpenArgs) Then
me.txtStudentID = Me.OpenArgs
End If

HTH,
Brian


David Widener said:
I am trying to use a popup form for entering and displaying data, I have a
button on a parent form I can open the popup with and enter data but the key
field is not updated so when I re-open the form the records are no longer
there they are in the table with no matching key, an old database I put
togather long ago had the following code and when I run it this way I get
Invalid use of Null from OpenArgs

Option Compare Database
Dim txtStudentID As String

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty = True Then
Me![strStudentID] = txtStudentID
End If
End Sub

Private Sub Form_Load()
txtStudentID = Me.OpenArgs
End Sub

Anyone know what is wrong, I would appriciate any help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top