Software

Clear an Access combo box for entering the next record

You can have Access clear the selection from a combo box in a data entry form so that the user starts fresh with each new record. See how to make this user-friendly tweak.

You've created a data entry form that uses a combo box, as shown in Figure A. However, when the user clicks the next record button, the previous record's combo box selection is still visible.

Figure A

To clear the entry for entering the next record, follow these steps:

  1. Open the form in Design view.
  2. Click the Form properties button at the top left of the form.
  3. In the Event tab, click the On Current property box and select Event Procedure (Figure B).

Figure B

  1. Click the Build button.
  2. Enter the following code at the prompt:

Private Sub Form_Current()

On Error Go to ErrorHandler

Me![cboname of box]= Null

ErrorHandlerExit

Exit Sub

ErrorHandler:

MsgBox "Error No: " & Err.Number &": Description: " & Err.Description

Resume ErrorHandlerExit

End Sub

  1. Press [Alt]+Q

Now when the user moves to the next record, the previous selection will not appear.


Miss an Access tip?

Check out the Microsoft Access archive and catch up on other Access tips.

Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.

Editor's Picks