473,386 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Form Closing and Adding Record

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
Nov 12 '05 #1
1 1798
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...
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William Wisnieski | last post by:
Hello Everyone, Access 2000, I have a main unbound form with a bound datasheet subform . The subform is bound to a query that returns records based on criteria in the main form. The user...
6
by: B Blue | last post by:
here's the situation: a produce dept at a grocery store needs to generate a weekly sheet for ordering. This is how it looks: 5 columns across with the following headings: Product Description,...
6
by: Miguelito Bain | last post by:
hi everybody- i have a form with 2 fields on it that i want the user to fill out before he or she can save the record, close the record, or move to the next record, etc... here's the code i...
15
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
2
by: S. van Beek | last post by:
Dear reader, I have a strange situation. In a Form with a list box to search for a record in the form it self. The field in the list box is also available in the form. On an other...
5
by: ortaias | last post by:
I have a form which calls up a second form for purposes of data entry. When closing the data entry form and returning to the main form, things don't work as expected. When I return to the main...
4
by: tlyczko | last post by:
I have been looking on the NGs and I found this code to show if a subform has no records. I have this code in the MAIN form OnClose event: Private Sub btnClose_Click() '4/16/06 new code that...
1
by: Iain | last post by:
I am attempting to create an "easy input (from the pov of the user)" form. A main form displays one page per record with a sub form displaying a list of records related to the main record. The...
2
by: Ron | last post by:
Hi All, Okay, I've got a frmOrders with a subform of sfrmDetails. A frmClient has all the client info, plus a subform of sfrmDefaults that has the client's normal ordering defaults (like set...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.