PDA

View Full Version : Clear a form on opening



MartinGM
08-05-2018, 04:10 AM
I have a simple form based on a query, all the fields being defined by the value in a ComboBox.

I can easily clear the form by setting the value in the ComboBox to "" and taking it from there.

But I would prefer the form to be clear when it opens, so in the form's On Load event I cleared the ComboBox. Although the rest of the On Load code runs correctly, clearing the ComboBox doesn't happen and the form opens with the first record showing. I guess that the first record is selected after the On Load code runs ?

Is there an easy way to fix this ?

Thanks

Martin

OBP
08-05-2018, 06:34 AM
Try the "On Open Event" instead.
However you may get an error from the On Current code which sets the combo to the current record.

MartinGM
08-05-2018, 09:30 AM
Try the "On Open Event" instead.
However you may get an error from the On Current code which sets the combo to the current record.

No errors, but no result either :(

OBP
08-06-2018, 01:09 AM
OK, you could open a new record, that would give you a blank form.

DoCmd.GoToRecord , , acNewRec

MartinGM
08-06-2018, 03:47 AM
Ingenious - and successful - thank you.