11-05-2019, 09:09 PM
|
#1
|
Newly Registered User
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
|
Knowing Previous number
hello all ,
In my form the first field to enter is kaizen number, & I have 5 depts., so the number would be a1,b1,c1,d1&e1 and so on .
Now as the list is getting long, I have to check each time what was the last number given to a particular dept. & I have to write the next number.
Is there any way to simplify this problem??
Thank you in advance.
|
|
|
11-05-2019, 09:32 PM
|
#2
|
AWF VIP
Join Date: Mar 2014
Location: The Great Land
Posts: 2,468
Thanks: 0
Thanked 573 Times in 569 Posts
|
Re: Knowing Previous number
Certainly can be dealt with.
Alpha sort rules apply. a15 will sort before a2 so if you searched for Max(fieldname), a2 would return instead of a15. Placeholder zeros can assure sequential order: a00001 … a00015.
So if you stored identifier parts in separate fields (Prefix, Number) an expression can concatenate to a sequential value when needed:
Prefix & Format(Number, "00000")
Or code can split value and recombine with formatting when needed.
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG! To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Last edited by June7; 11-05-2019 at 09:43 PM.
|
|
|
The Following User Says Thank You to June7 For This Useful Post:
|
|
11-06-2019, 09:51 AM
|
#3
|
Software Engineer
Join Date: Oct 2019
Location: Iowa City, IA, USA
Posts: 630
Thanks: 78
Thanked 69 Times in 69 Posts
|
Re: Knowing Previous number
Quote:
Originally Posted by Ravi Kumar
I have to check each time what was the last number given to a particular dept. & I have to write the next number.
|
r u saying that your next numbers would be like "a2, a3, etc..." for records pertaining to your 1st department and "b2, b3, etc..." for the 2nd department? or r u saying that each future record would need to be "f1, g1, h1, etc..."?
June is giving a solution for the 1st scenario.
|
|
|
The Following User Says Thank You to vba_php For This Useful Post:
|
|
11-06-2019, 08:34 PM
|
#4
|
Newly Registered User
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
|
Re: Knowing Previous number
Yes Sir it is exactly as you described...
|
|
|
11-06-2019, 09:27 PM
|
#5
|
AWF VIP
Join Date: Mar 2014
Location: The Great Land
Posts: 2,468
Thanks: 0
Thanked 573 Times in 569 Posts
|
Re: Knowing Previous number
vba_php described two scenarios. Which one applies to you? The second one doesn't seem feasible.
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG! To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
The Following User Says Thank You to June7 For This Useful Post:
|
|
11-06-2019, 10:35 PM
|
#6
|
Software Engineer
Join Date: Oct 2019
Location: Iowa City, IA, USA
Posts: 630
Thanks: 78
Thanked 69 Times in 69 Posts
|
Re: Knowing Previous number
Quote:
Originally Posted by Ravi Kumar
Yes Sir it is exactly as you described...
|
Ravi,
This answer of yours is very vague! You didn't answer my question, or June's latest message. Please clarify WHICH situation I described applies to your situation. That way we can help you.
|
|
|
The Following User Says Thank You to vba_php For This Useful Post:
|
|
11-07-2019, 01:33 PM
|
#7
|
Super Moderator
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 28,316
Thanks: 15
Thanked 1,600 Times in 1,520 Posts
|
Re: Knowing Previous number
Start by keeping the two fields separate. Then you can use a DMax() to find the highest numeric value for the department and add 1 to generate the next number.
Me.NextNum = Nz(DMax("SeqNum", "yourtable", "DeptLetter = '" & Me.DeptLetter & "'"), 0) +1
__________________
Bridge Players Still Know All the Tricks
|
|
|
The Following User Says Thank You to Pat Hartman For This Useful Post:
|
|
11-09-2019, 03:16 AM
|
#8
|
Newly Registered User
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
|
Re: Knowing Previous number
Quote:
Originally Posted by vba_php
Ravi,
This answer of yours is very vague! You didn't answer my question, or June's latest message. Please clarify WHICH situation I described applies to your situation. That way we can help you.
|
Hello sir , I am very sorry , I was not in town hence I couldn't answer to your questions.
My requirement is like this : While entering kaizen details I give unique names to it for index purpose like for production department it would be PRD-01 , PRD-02 and for calibration department CD-01,CD-02 & so on .
As now it has become sufficiently big , before giving the number I need to first look at the last number allotted in my datasheet ,again come back to form & enter the same .
So I need to know whether this can be simplified in any way ??
|
|
|
11-09-2019, 03:17 AM
|
#9
|
Newly Registered User
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
|
Re: Knowing Previous number
Quote:
Originally Posted by Pat Hartman
Start by keeping the two fields separate. Then you can use a DMax() to find the highest numeric value for the department and add 1 to generate the next number.
Me.NextNum = Nz(DMax("SeqNum", "yourtable", "DeptLetter = '" & Me.DeptLetter & "'"), 0) +1
|
Hello sir thank you. I Will try & let you know the result.
|
|
|
Thread Tools |
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
All times are GMT -8. The time now is 08:19 PM.
|
|