i have a field with numbers in it and was wondering if i can do a query to only keep the last 4 digits in the field. thanks!
format field
Collapse
X
-
Tags: None
-
-
I'm running out the door, and I'm sure that there is an easier way, but here is what I come up with in a flash:
SAMPLE RESULTS:Code:Public Function fFormatLong(lngNumber As Long) As String fFormatLong = Format(((lngNumber / 10000) - Fix(lngNumber / 10000)) * 10000, "0000") End Function
Code:Debug.Print fFormatLong(1) 0001 Debug.Print fFormatLong(27) 0027 Debug.Print fFormatLong(892) 0892 Debug.Print fFormatLong(4320) 4320 Debug.Print fFormatLong(16230) 6230 Debug.Print fFormatLong(999992) 9992 Debug.Print fFormatLong(1234567) 4567
Comment
-
-
didacticone, pay absolutely no attention to what that ADezii Character gave as a Reply in Post #5! Do, however, follow OldBirdman's advice in Post #6! (LOL)!Comment
Comment