Auto create record in subform NZ is not working

  • Thread starter Thread starter Ken Ivins
  • Start date Start date
K

Ken Ivins

I have a form with participants to an event and their billing information.
On it is a subform for multiple payments to this event. To get a balance due
report I need to have some figure as a payment (even if is zero). How do I
automatically create a record in this subform when ever a participant is
created or is there a better way to do this.

Peter Walker suggested I try the Nz function which sounded good.

I tried the following code on a field on the main form and got an "Object
doesn't support this property or method" error.

Private Sub txbLastNam_AfterUpdate()
Me![sfrmConferencePayment].[txbPaymentAmt] =
Nz(Me![sfrmConferencePayment].[txbPaymentAmt], "0")
End Sub

I assume this is because there is no record created yet, but maybe I'm
wrong. I'm looking for ideas.

Thanks,
Ken
 
Ken Ivins said:
I have a form with participants to an event and their billing information.
On it is a subform for multiple payments to this event. To get a balance due
report I need to have some figure as a payment (even if is zero). How do I
automatically create a record in this subform when ever a participant is
created or is there a better way to do this.

Peter Walker suggested I try the Nz function which sounded good.

At some point in the process or before you save the master record
I assume you have an autonumber for the record key.
docomd.runsql "INSERT INTO Billing (ParticipantID,SomeAmountField) VALUES ("
& Me!ParticipantID & ",0);"
 
Not sure what that means. The statement does insert a record and all you
would have to do is refresh the view.
 
Back
Top