I have a simple update that pads the beginning of a field entry with zeros.
I am sure there is a better way to do this.
Here is the current code
Problem I have is this.
The current code only deals with one apha prefix.
FileNumbers can be.
A123456789
A12345678
S123456789
S12345678
T123456789
T12345678
W123456789
W12345678
But there are also reciept file numbers that are formated like...
[3 alpha character site code][10 numeric]
So a reciept number would look like,
ABC1234567890
---------------
The logic I believe would be
if prefix = [a-zA-Z][a-zA-Z][a-zA-Z] then skip
if length is less then 9 then look at first character.
if 1st char = IN (A,S,T,W) then pad after the (A,S,T,W) pad the needed zeros.
Just not sure how do do this as VBA.
Thanks
John Fuhrman
I am sure there is a better way to do this.
Here is the current code
Code:
'------------------------------------------------------
'------------------------------------------------------
' Updated A File Numbers to 8 digits
'------------------------------------------------------
'------------------------------------------------------
SQLText = "UPDATE tblTrackingParse SET tblTrackingParse.FileNumber = 'A0' & Right([FileNumber],8) " & _
"WHERE ((([tblTrackingParse].[FileNumber]) Like 'A*'))"
DoCmd.RunSQL SQLText, True
'------------------------------------------------------
'------------------------------------------------------
' Updated A File Numbers to 9 digits
'------------------------------------------------------
'------------------------------------------------------
SQLText = "UPDATE tblTrackingParse SET [tblTrackingParse].[FileNumber] = 'A' & Mid([FileNumber],2,8)" & _
" WHERE ((([tblTrackingParse].[FileNumber]) Like 'A00*'))"
DoCmd.RunSQL SQLText, True
Problem I have is this.
The current code only deals with one apha prefix.
FileNumbers can be.
A123456789
A12345678
S123456789
S12345678
T123456789
T12345678
W123456789
W12345678
But there are also reciept file numbers that are formated like...
[3 alpha character site code][10 numeric]
So a reciept number would look like,
ABC1234567890
---------------
The logic I believe would be
if prefix = [a-zA-Z][a-zA-Z][a-zA-Z] then skip
if length is less then 9 then look at first character.
if 1st char = IN (A,S,T,W) then pad after the (A,S,T,W) pad the needed zeros.
Just not sure how do do this as VBA.
Thanks
John Fuhrman