help with an update query from form data...

B

Brook

I have a frminvoicepaymentssubform with the following controls:

MaxPaymentDate =DLookUp("paymentdate","tblinvoicepayments","[invoiceid]=" &
[invoiceid] & "And [paymentid]=" & [MaxPaymentID])

MaxPaymentID =DMax("paymentid","tblinvoicepayments","[invoiceid]=" &
[invoiceid])

MaxAmountDue =DLookUp("amountdue","tblinvoicepayments","[invoiceid]=" &
[invoiceid] & "And [paymentid]=" & [MaxPaymentID])

I on close of the form, I want to update my tblinvocepayments fields
MaxPaymentDate and MaxPaymentAmount from the form fields:

So, tblinvocepayments PayoffDate = MaxPaymentDate
PayoffAmt = MaxAmountDue

I tried the following code in an update query, but it only updates my the
record in the table?

Begin Update Query Code:

UPDATE tblinvoicepayments SET tblinvoicepayments.MaxPmtDate =
forms!frminvoicepaymentssubform!MaxPaymentDate, tblinvoicepayments.MaxPmtAmt
= forms!frminvoicepaymentssubform!MaxAmountDue
WHERE
(((tblinvoicepayments.paymentid)=[forms]![frminvoicepaymentssubform]![paymentid]));
End Update Query Code:



Does anyone have any ideas to help me?

Thanks,

Brook
 
M

[MVP] S.Clark

What do you mean by it ONLY updates the record in the table? Where else
should the query update?

The form is closing, so where else do you need it to update?

--
Steve Clark, Access MVP
FMS, Inc.
Call us for all of your Access Development Needs!
1-888-220-6234
(e-mail address removed)
www.fmsinc.com/consulting

Brook said:
I have a frminvoicepaymentssubform with the following controls:

MaxPaymentDate =DLookUp("paymentdate","tblinvoicepayments","[invoiceid]="
&
[invoiceid] & "And [paymentid]=" & [MaxPaymentID])

MaxPaymentID =DMax("paymentid","tblinvoicepayments","[invoiceid]=" &
[invoiceid])

MaxAmountDue =DLookUp("amountdue","tblinvoicepayments","[invoiceid]=" &
[invoiceid] & "And [paymentid]=" & [MaxPaymentID])

I on close of the form, I want to update my tblinvocepayments fields
MaxPaymentDate and MaxPaymentAmount from the form fields:

So, tblinvocepayments PayoffDate = MaxPaymentDate
PayoffAmt = MaxAmountDue

I tried the following code in an update query, but it only updates my the
record in the table?

Begin Update Query Code:
UPDATE tblinvoicepayments
SET
tblinvoicepayments.MaxPmtDate =
forms!frminvoicepaymentssubform!MaxPaymentDate, tblinvoicepayments.MaxPmtAmt
= forms!frminvoicepaymentssubform!MaxAmountDue

WHERE
(((tblinvoicepayments.paymentid)=[forms]![frminvoicepaymentssubform]![paymentid]));

End Update Query Code:
 

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