I'm creating a Project ID and I'm having some trouble getting VBA to respond to correctly. My Project ID has to have 4 digits, so I'm taking the Autonumber ID that Access creates, and adding 0's before depending on how many digits it is.
Here's the code I'm using:
Expand|Select|Wrap|Line Numbers
- iTempID = Me.ID.Value
- If iTempID > 999 Then iTempID = iTempID
- If 99 < iTempID < 1000 Then iTempID = "0" & iTempID
- If 9 < iTempID < 100 Then iTempID = "00" & iTempID
- If 10 > iTempID Then iTempID = "000" & iTempID
- Me.ProjectID.Value = iTempID
Thanks
Robin