D
Daniel Wilson
I have a form ("Sales") with several subforms. One of the subforms,
"Purchaser", is tied to the Sale record by a Purchaser ID in the Sale
record.
When I enter the Purchaser subform, I have some code to add a new
purchaser record if the Purchaser ID in the Sale record is NULL or 0.
The problem comes when I've just added a Sale from the Sales form using
the Add (rightmost) button of the record navigator. When I enter the
Purchaser subform, the current record is the one before the add. At
least, the Purchaser ID and the Sale ID are reported that way.
Private Sub Purchaser_Enter()
Dim lNew As Long
'On Error Resume Next
'Line below shows Purchaser from record before add!
'*****************vvvvvvvvvvv*********************
If IsNull(Me.Recordset!Purchaser) Or Me.Recordset!Purchaser = 0 Then
lNew = AddCustomer()
Me.Recordset.Edit
Me.Recordset!Purchaser = lNew
Me.Recordset.Update
Purchaser.Requery
CurrentCustID = lNew
End If
End Sub
What am I doing wrong?
Thanks.
Daniel Wilson
"Purchaser", is tied to the Sale record by a Purchaser ID in the Sale
record.
When I enter the Purchaser subform, I have some code to add a new
purchaser record if the Purchaser ID in the Sale record is NULL or 0.
The problem comes when I've just added a Sale from the Sales form using
the Add (rightmost) button of the record navigator. When I enter the
Purchaser subform, the current record is the one before the add. At
least, the Purchaser ID and the Sale ID are reported that way.
Private Sub Purchaser_Enter()
Dim lNew As Long
'On Error Resume Next
'Line below shows Purchaser from record before add!
'*****************vvvvvvvvvvv*********************
If IsNull(Me.Recordset!Purchaser) Or Me.Recordset!Purchaser = 0 Then
lNew = AddCustomer()
Me.Recordset.Edit
Me.Recordset!Purchaser = lNew
Me.Recordset.Update
Purchaser.Requery
CurrentCustID = lNew
End If
End Sub
What am I doing wrong?
Thanks.
Daniel Wilson