Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    May 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Closing form after opening search

    I have a form used to enter and edit students that opens in the "Add" mode. On this form I have button that opens a blank form in the "Filter By Form" mode. If I close this "Search" form by right clicking on the tab or by clicking on the "X" to the right, my original form re-opens in the Edit Mode and opens at the first record in the Table from which it derives its data.

    Is there a way to close the Search Form and go back to the original form in the "Add" Mode? Or, better said, is there a way to close and go back to a blank form?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    One approach you might try is to set the form mode to Add each time the form gets focus using the OnFocus event for the form and some VBA to set that form property. But it is a bit of a mystery as to why the form changes to edit mode - unless you are setting it that way from the Search form code.
    Wendell

  3. #3
    New Lounger
    Join Date
    May 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried to do that but it precludes me from using the filter. If I toggle the filter the VBA in the OnFocus Event clears the filter and goes back to a blank record. It's a good start, and it cures one problem but it keeps the "Filter By Form" from working as it should.

    I would like to close the "Search By Form" filter when it's toggled by mistake without going back to record #1.

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    Are the data entry form and the search form using the same form so that you end up with two copies of the same form when the search form is open? If you can post a simple version of the database that demonstrates the behavior with dummy data, we can probably make better suggestions. Also, what version of Access are you using and is the database in .mdb format or .accdb format.
    Wendell

  5. #5
    New Lounger
    Join Date
    May 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The data entry form and the search form look exactly the same.

    I tried to upload a dummy copy of the database but the site keeps rejecting my efforts and I'm not sure it is worth my time to try to attach it. Finally got it to upload and got the message "invalid file." Not real user friendly.

    My database is in the .accdb format.

    If the form is open in the Add mode and all you do is click the "Toggle Filter" button in the ribbon, the form goes back to the edit mode. I would like it to return to the "Add" mode.

Tags for this Thread

Posting Permissions

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