Mike <me@you.com> wrote in message news:<u8********************************@4ax.com>. ..
I have a form that certain information on it. On this form there is a
button that opens a payment form.
When the payment form opens I enter a payment type, check cash charge,
payment number, check number or cc number, and then payment amount.
Next I click a button to process the payment which uses a sql
statement to insert the record into a payment table.
This all works fine. My problem is that when I click the custom close
button on the form, before the form closes it adds another payment
record.
How do I stop the second record from being added?? It is driving me
crazy.
Thank you very much in advance!!
Michael Charney
sounds like your Payment form is bound to a table, and for some reason
you're trying to write the record to the table with code behind a
button. So you're clicking the button, it adds the record, and then
you're closing the form, and it's saving the data again. Do one of
the following: (1) remove the code that inserts the new record; (2)
remove the recordsource from the form, so it can't write anywhere...
Personally, I'd chose #1. If you write the record to the table in
code, then you have to do all the checking for null values and all
that yourself. PITA if you have a lot of fields with complex
validations...