Starting Check Number

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Starting Check Number

Post by burrina »

I have a payroll db where I assign check numbers, etc... I have code for this using DMax but of course for a new db there would be no check number to add to. What is your suggestion? I can only think of just adding a dummy record with only the starting check number.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Starting Check Number

Post by HansV »

You can use something like

Nz(DMax("CheckNumber","TableName"),0)+1

where CheckNumber is the relevant field and TableName the relevant table.
Best wishes,
Hans

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: Starting Check Number

Post by burrina »

Yes, I have DMax("[CCheckNo]", "TCheckNo") + 1
But no starting number to advance to. So my only solution is to add a dummy record in the table! The user would not want to start with the number 1 for a starting check number.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Starting Check Number

Post by HansV »

Try using

Code: Select all

Nz( DMax("[CCheckNo]", "TCheckNo"), 999) + 1
where 999 is one lower than the start number you want to use.

This should return 1000 if you want to start with 1000 if there are no records in TCheckNo. You can use any other number of course.
Best wishes,
Hans

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: Starting Check Number

Post by burrina »

Good Idea. That will work. Thank You