update query number +1

P

pdehner

I have inherited a database which has a field for check
number and would like to add the actual check number when
printed. I think I need an update query to increment the
check number by 1 for each record in the table. I can
update the check number by one but not increment it for
each record.
Any suggestions or ideas would be appreciated.
Thanks
 
D

Duane Hookom

Maybe you could type in a few fields from a few records and add the
field/calculation that you would like to see in the table.
 
P

pdehner

I don't understand .. I envision having the user type in
the first check number in a pop up window then printing
the checks - The actual check number doesn't need to
appear on the check but does need to update the check
number field in the table.
Thanks for your help
 
D

Duane Hookom

How do you know which order the check numbers should be applied to the
records? You might have an issue if you can't suggest the field(s) that
provide the order for entering/incrementing the check numbers. If you type
some values into an email, we might be able to identify what your
order/sequence is.
 
P

Pdehner

Checks to be printed are imported from an excel file to
the table and they are imported in payee_id order. I
hope this is the information you need to help me with
this.
Thanks for your help.
 
D

Duane Hookom

Update tblYourTable
SET CheckNum = DMax("CheckNum","tblYourTable") +
DCount("*","tblYourTable","CheckNum Is Null AND Payee_ID <=" & Payee_ID);
This should start numbering where you left off. If you want to start at your
own number, you can replace the DMax() with an input parameter or reference
to a form and then change the later <= to just <.
 

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