How do I clear all controls on a page when the database is first opened?

  • Thread starter Thread starter Mike Matheny
  • Start date Start date
M

Mike Matheny

Right now, the fields populate with the first record in the bound table. I
want to start out with a clean slate, and pick the customer name from my
combo box, which then populates the data after the combo box updates.
 
Hi Mike

Does your form allow new records to be added? The easiest way is to go to a
new record when your form opens:

In Form_Load:
DoCmd.GotoRecord Record:=acNewRec

Another option is to open the form in data entry mode, and switch it the
first time the selection combo is used:

In cboSelect_AfterUpdate:
Dim lSavedSelection as long
lSavedSelection = cboSelect.Value
If Me.DataEntry then Me.DataEntry = False
' carry on selecting record

Note that you must save the selection value because changing the DataEntry
property will cause Form_Current to be executed, and it's usual practice to
set the selection combo value for the current record at that point.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top