473,796 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1823
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
4764
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 then double clicks a row on the datasheet subform to open yet another form bound to a table . These two forms are linked by the field. So far so good.
6
1640
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, UPC code, Case Quantity, Case Price, Retail Price - Product Description, UPC code, Case Quantity, are all to be drawn from a table containing 100 records. -Case Price, Retail Price are fields which will appear empty but allow data entry
6
6588
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 tried. if i just enter minutes and click close, the form closes. it seems to bypass my nested if statement.
15
4664
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 field to start. If I edit that field and then click on the new record button in the navigation buttons, the form goes to a new record and each field has the default value of the previous record. If I put the focus in any field to start, edit that...
2
2934
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 form I
5
3934
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 form, I trigger the on acitvate event to run a macro. I can use the Dlookup function to update my fields, which is OK. However, I intitially tried to use the Repaint Object command to repaint the form. That did not work. Though I solved the...
4
3136
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 cancels the close event if the BeforeUpdate code fires '4/16/06 see...
1
1732
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 sub records can be updated manually (in particular -added). I want to add functionality where a user can also update (add) from a lookup. The look up is listing of records, (I am not adding a drop down because of multiple field search requrements)...
2
1760
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 products they always order, just no quantity). The frmClient form has a button for adding or modifying orders by popping up the frmOrders (with it's subform) and everything works well so far. I can manually input the orders, with details, etc. ...
0
9683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10231
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10013
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6792
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4119
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2927
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.