Auto create record in subform NZ is not working

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
 
M

Mike Painter

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);"
 
M

Mike Painter

Not sure what that means. The statement does insert a record and all you
would have to do is refresh the view.
 

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