Consulting

Results 1 to 5 of 5

Thread: Clear a form on opening

  1. #1
    VBAX Regular
    Joined
    Jul 2018
    Posts
    17
    Location

    Clear a form on opening

    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

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    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.

  3. #3
    VBAX Regular
    Joined
    Jul 2018
    Posts
    17
    Location
    Quote Originally Posted by OBP View Post
    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

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    OK, you could open a new record, that would give you a blank form.

    DoCmd.GoToRecord , , acNewRec

  5. #5
    VBAX Regular
    Joined
    Jul 2018
    Posts
    17
    Location
    Ingenious - and successful - thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •