linking two forms/transferring data from one form to another

nish2009i

Registered User.
Local time
Today, 06:29
Joined
Jan 24, 2009
Messages
11
hi all,

i have a booking form which enables users to make a booking and when the Status becomes "completed" , PAY button becomes active which can be clicked in order to make a payment FOR THAT BOOKING only...

the problem: the code behind the payment form is:



Private Sub form_load()

DoCmd.GoToRecord , "", acNewRec
txtPaymentID.Locked = True
txtPaymentID.BackColor = &HECECEC 'light grey as hexadecimal number
cboMethPay.SetFocus


Me.cboBookingID = Forms("frmbooking")("txtbookingid") 'copies the booking ID from booking form

Me.txtAmount = Forms("frmbooking")("txtcost") 'copies cost



this is OK when the payment is made first time, however, when the user goes back to the booking form, the STATUS of booking is going to stay COMPLETED and PAY button is active, so when PAY is clicked, the payment form generates new Payment ID! it lets the users fill in the fields to make another payment but THANKFULLY, on SAVE, it says that it wil create duplicate values.

so how do i stop the PAYMENT form from generating new payment ID when the booking is already paid for?
 
>>> when the user goes back to the booking form,<<<

Why not close the booking form when you leave it and then reopen it again from the payment form?
 
same thing happnes.. i meant to say that even when the forms are closed, and opened again, when flicking through bookings, if the user clicks on PAY for one of the paid bookings, the payment form opens for a booking (regardless of whether its already been paid or not) and the code still lets it make another payment i think thats because i have a docmd.acnew code thats y but i need that code for it to generate a new payment the first time the booking is paid for! i dont know how to do it so that.. if a payment is made for the booking then a message comes up saying: "payment already made" r something like that?
 

Users who are viewing this thread

Back
Top Bottom