formating a table cell

  • Thread starter Thread starter Daniel M
  • Start date Start date
D

Daniel M

I have a problem formating a table cell. I have a form that takes input from
a barcode scanner. In the table the format is 12-3456. In the form i may
enter 12-3456 or 123456. Because this is scanned from a barcode i need to be
able to accept either input. It will look at the table and pull up any
matching records matching the 12-3456 format, regardless of what is entered.
If the table does not contain the number it will write it to the table in
the same 12-3456 format.

I can make it accept 12-3456 OR 123456 and make the table format be 12-3456
but i cannot seem to get it to accept both formats. Thanks for any help!

dm.
 
I have a problem formating a table cell. I have a form that takes input from
a barcode scanner. In the table the format is 12-3456. In the form i may
enter 12-3456 or 123456. Because this is scanned from a barcode i need to be
able to accept either input. It will look at the table and pull up any
matching records matching the 12-3456 format, regardless of what is entered.
If the table does not contain the number it will write it to the table in
the same 12-3456 format.

I can make it accept 12-3456 OR 123456 and make the table format be 12-3456
but i cannot seem to get it to accept both formats. Thanks for any help!

dm.

Try setting the Input Mask property to

"00-0000;1"

to have it display the hyphen if it's not typed (or scanned), or accept it as
puntuation (but not store it).

John W. Vinson [MVP]
 
I would not format the control at all, and use the AfterUpdate event of the
control to conditionally create the input. It might look something like the
following untested code:

Sub txtWhatever_AfterUpdate()
If InStr(1, Me.txtWhatever, "-") = 0 Then
Left(Me.txtWhatever, 2) & "-" & Right(Me.txtWhatever, 4)
Else

End If
End Sub

That adds the - if it isn't there and leaves it alone if it is.
 
Back
Top