brewpedals
Registered User.
- Local time
- Today, 06:07
- Joined
- Oct 16, 2002
- Messages
- 32
Hi all,
I have a sql statement I am using in a VBA sub that I intended to find the maximum value of the last three characters in a text field (JOB_NO) whose values are all in this format - "00L000". Example - "05J123"
It works fine when the last three characters represent a 3 digit number like "123", but fails when they are "002" - it returns the value "5J2".
Later in my code I increment the value (NextSeqNbr) by one to find the next available job number. How can I preserve the precedeing zeros?
I appreciate your help.
SQL Statement:
SELECT Max(Right([Project_Tracking].[JOB_NO],3)) AS NextSeqNbr FROM Project_Tracking HAVING ((((Left([Project_Tracking].[JOB_NO],2)=Right(Year(Now()),2)))));
I have a sql statement I am using in a VBA sub that I intended to find the maximum value of the last three characters in a text field (JOB_NO) whose values are all in this format - "00L000". Example - "05J123"
It works fine when the last three characters represent a 3 digit number like "123", but fails when they are "002" - it returns the value "5J2".
Later in my code I increment the value (NextSeqNbr) by one to find the next available job number. How can I preserve the precedeing zeros?
I appreciate your help.
SQL Statement:
SELECT Max(Right([Project_Tracking].[JOB_NO],3)) AS NextSeqNbr FROM Project_Tracking HAVING ((((Left([Project_Tracking].[JOB_NO],2)=Right(Year(Now()),2)))));
Last edited: