Update Query With Calculations

C

Chaster

I am attempting to do a check writing routine and need help with updating
some of the fields in my table.

I am working with two tables

tblLastCheck![LCN]

tblAccountsPayable
[DatePaid]
[CheckNumber]
[SupplierID]

I want to store the value that is in the tblLastCheckNumber![LCN] and add 1
to it
IE: tblLastCheck![LCN] = 100

Dim UpdatedLCN as long
UpdatedLCN =DlookUp ("LCN","tblLastCheck") ' This is a 1 field table

I then need to find the records that match the [SupplierID]= "ATE" on the
1st check that is printed and update
[DatePaid] = Date()
[CheckNumber] = UpdatedLCN ' This would be check number 101

I then need to update the variable UpdatedLCN
UpdatedLCN = UpdatedLCN + 1

find the records that match the 2nd checks [SupplierID] = "D&N"
[DatePaid] = Date()
[CheckNumber] = UpdatedLCN ' This would be check number 102

etc, etc

And then I would think that I need to set the value in my tblLastCheck![LCN]
= UpdatedLCN

I could use advise on when this should be run (prior to printing checks)? on
the onformat or onprint when printing the checks? or after the checks have
been printed? and of course help with the syntax to accomplish this routine.
TIA
 

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