Different Data Types

T

tonyak

In our master table the employee no's are input as "000000100". I would like
to reference this table from a database I created using the employee # of 100
(no leading zeroes). I want them to be able to only type 100, but look up
"000000100" in the master table.

What is the best way to handle this?
 
M

mscertified

Create a VBA function like the following:

Function PadZeroes(strAbbrev as string) as string
PadZeroes = right$("000000000" & strAbbrev,9)
End Function

The function takes the input number and pads it with zeroes to a maximum
length of 9 characters. Use this function in your query e.g.
SELECT Employee where EmployeeNumber = PadZeroes(AbbrevNumber)

This is one way to do it, there may be other approaches. This is likely to
slow down your queries somewhat.
 
Top