On a typical Point-of-Sale screen a form would probably have a number of grouped buttons which represent various options that the user can select as well as a menu system to select groups of items. For example, a restaurant terminal where the check out operator would be able to select a main type of item (Beverages, Drinks, etc) and then choose items within the selected group to add to the bill.
The conventional method to create this sort of form would be to have dozens of separate buttons on the form which would have the captions changed whenever a group was selected and some code behind every button to process the events depending on the currently selected group. The problem with this method is that it is not very flexible and making any changes to the form contents can result in a lot of changes to the VBA code which can be 'messy' and time consuming.
Where the screen buttons are the same size and are in a specific grid pattern it can be easier and more efficient to use a different technique to detect the buttons that are pressed by the user and that is to use a single transparent button over a grid of Label controls and when a square in the grid is clicked, the X and Y co-ordinates of the button are used to determine which grid cell was selected and take the appropriate action. In the attached demo below, there are a possible 192 selections available to the user but there are only two Command buttons on the whole form (see the screen shots below). This means that only a few lines of VBA code are required to give a large number of possible choices to the user which, in turn, is easier to program and maintain. Also, since the button captions (and other parameters such as colors, format, etc) are stored in a table, it is easier for the users to set up their own screen layout by providing them with a form in which they can edit or add to the various groups and sale items on the form (this facility is not provided in this demo though). The main criteria for the grid layout is that all the Label controls must be the same size and shape so that the position of the label can be calculated from the X and Y co-ordinates of the hidden button when the button is clicked.
The table (tblSaleItems) holds the information for each sale item name, the price of the item, the main group in which it belongs and a location reference which determines in which grid cell the item will be displayed. This is the grid co-ordinate in the format 00 (top left cell) to 53 (bottom right cell). The ItemRef field is an AutoNumber field and is not actually used in the demo. The VBA code is fairly well documented but if there is anything that is not clear then feel free to post any questions here. Note that the blank cells need some character (I have used an asterisk) because a Label type control will not display if it has no caption value. Of course, in a real PoS database there would need to be more code to add the prices together for each selected item and display the total on screen, edit an item price, print a bill, etc, etc but this demo is only intended to demonstrate the button selection technique. Also note that if you want to change any of the Label controls on the form you will need to move the 'invisible' button out of the way first. In fact, you could make these buttons very small in Design mode and then resize and re-position them at Run time which would make altering the form controls a bit easier at Design time.
The 12 button keypad (which is separate from the main demo) just shows how the same method could be used to enter a number into a Text field. The button events for the hidden button here are also used to change the label Special Effect property to simulate a button press.
This demo is written in A2003 but works OK in later versions.