OK I just tried entering into a form using code builder. Im not seeing
results but I think I am missing something.
I placed the code in the ON CLICK event.
So I would need this coed to work with 5 different possiblilites. For
instance DEB-123, JEN-345, YAN-500,SUE-321, TOM-765. SO each of these (5)
would need the next new number each time the form opened and the first three
letter were enter (thats the prefix I was refering to)
Thanks Yanick!!!
Yanick said:
I can't say if it is the best solution but this is how I did it in the past.
Were to place this code will depends of your db logics. When do you need it?
I will need more details about your DB.
--
Yanick
:
Hi Yanick,
Thank you so much, I wasnt going to use Vb but I will if you think its the
best way. Where would I put all this?
:
Try this (I assumed you are trying to do this in VBA, if not let me know)
'First check if the table is empty
If Not IsNull(DMax("[YourAutoFieldNumber]", "YourTable")) Then
sAutoNumber = DMax("[YourAutoFieldNumber]", "YourTable")
sAutoNumber = "DEB-" & Int(Right(sSnagNumber, 4)) + 1
Else
sAutoNumber = "DEB-1"
End If
--
Yanick
:
Hi Everyone,
I am working on a project where we need to be able to enter the net
number in a series (not an auto number field). So, for instance if I have
DEB-12, DEB-13, DEB-14, how could I find out what number I should use next
without having to look it up each time. We are using so many of these
prefixes that it is difficult to keep track.
Thanks sooooo much!