navcan
Posts: 61
|
Posted: 07/14/2004, 5:26 AM |
|
I am using CC Ver: 2.0.7 (ASP with Templates) and Access Database.
The table has only three fields:
ID - Primary Key (AutoNumber)
CATEGORY Text Field (Max 3 Characters)
CATCODE Text Field (Max 7 Characters)
I am trying to combine ID and CATEGORY fields and saving the combined information in CATCODE field by using before Insert or before Update event
FldCATCODE = fldCATEGORY & fldID
It works fine, for example
ID = 2
CATEGORY = DJM
So CATCODE = DJM2
BUT
I want to format the ID with 4 digits like if the ID is 1 format it as 0001, if it is 238, format it as 0238 and then want to have CATCODE = DJM0001, DJM0238, DJM0762 and so on
The reason to have that format is for making it a standard format for inventory and barcode purpose.
I checked everywhere but could not find an example of vbscript to replace the number with leading zeros
I know in MS Access we can simply format (mask) it as following:
CATCODE=[CATEGORY] & Format([ID],"0000")
When I use the above, I get an error because ASP/VBScript cannot understand Format function.
I know there must be a way to achieve that result but my brain is frozen and I need your help...
Waiting....
regards,
navcan
|
|
|
|