mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (February 2007)

Verifying a Value Read by a Barcode Scanner

Say you have a table called ITEMS and one of the columns in that table is BARCODE. In your ORDER.VCE form, when you scan an item with a barcode reader, you want to verify that the item is in the ITEMS table and (if it is not) you want to put up a message.

Set up your ORDER.VCE form as follows:

  1. Create and edit control and connect it to @var(34) (as a text)
  2. Create a lookup control that searches the ITEMS table, using @var(34) as the key, seaching the BARCODE column. When asked if you want to save the value found, say YES. Save the value found in @var(57).
  3. Create a macro with the following steps:
      Step i: SKIP if @var(34) = @var(57) then 2 else 0
      Step ii: Message box: "Value not found"
      Step iii: Return from macro
      Step iv: Message box: "Value found"
      Step v: Return from macro
  4. Create a "Run macro" command button and have it run the macro you just created in (3).
  5. Select FORM | CONTROL ORDER and make sure that the button you created in (4) is immediately after the edit control you created in (1).

If you have a Symbol or Socket scanner: Make sure that the vendor supplied keyboard wedge is off when you start the form. Visual CE will enable the scanner when the edit control you created in (1) has focus. When the user scans into the edit control, Visual CE will automatically press the button you created in (4).

If you don't have a Symbol or Socket scanner (or if vendor supplied keyboard wedge is on): Modify the keyboard wedge's properties to append a <TAB> and a <SPACE> after every barcode scan. When the user scans into the edit control, the <TAB> will set focus to the next control (the button) and <SPACE> will press the button.