Starting Check Number
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Starting Check Number
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.
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Starting Check Number
You can use something like
Nz(DMax("CheckNumber","TableName"),0)+1
where CheckNumber is the relevant field and TableName the relevant table.
Nz(DMax("CheckNumber","TableName"),0)+1
where CheckNumber is the relevant field and TableName the relevant table.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: Starting Check Number
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.
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.
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Starting Check Number
Try using
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.
Code: Select all
Nz( DMax("[CCheckNo]", "TCheckNo"), 999) + 1
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
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: Starting Check Number
Good Idea. That will work. Thank You