inputmask in VBA

  • Thread starter Thread starter Luciano
  • Start date Start date
L

Luciano

I have some controls in a form wit h an Inputmask. Depending of my client, I
must have another inputmask for these controls. (For Example: the inputmask
for a telephone in Belgium(BE) is "000000000" (9X0) and in The
Netherlands(NL) "0000000000" (10X0). In VBA it will be something like this:
If Country = "BE" then
forms!frmReservations!txtTel.Inputmask="0000000000"
end if
If Country="NL" then
forms!frmReservations!txtTel.Inputmask="0000000000"
end if
In which module have I to write this code?
 
Hi Luciano,

Place it in the form's On Open event. You might use want to use a
table instead to store the masks so that you do not have to modify you code
each time you add another country. You would just add a new row to the
country settings table. Then you could do something like this in the On Open
event:

forms!frmReservations!txtTel.Inputmask=DLookup("TelephoneMask",
"tblCountrySettings", "CountryCode = """ & Country & """")

That is all on one line. If you are putting this inside your
frmReservations form's On Open event, you can drop the
"forms!frmReservations!" part and just start with "txtTel....".

Hope that helps,

Clifford Bass
 
Back
Top