Results 1 to 12 of 12
  1. #1
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33

    Open a form with button, close, and resume focus on original record in main form


    THIS HAS BEEN SOLVED. SOMETHING MESSED UP AND CANNOT PUT SOLVED ON THE THREAD TITLE


    My idea was this...When entering a new record into the main form and discovering that the Part Number I'm trying to enter isn't in the db yet (indexed), that by clicking on the Enter New Part Number button, type in new number, exit the Enter New Part Number form, and resume back to my main form at the same record I was originally on with the main form having been requeried so now the new Part Number will show up in my combo box.

    Any suggestions?

    Attachment 6025
    Last edited by HeadGasket; 01-26-2012 at 01:14 PM. Reason: Solved

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I get an error trying to view the screen shots, but the most common way of doing this wouldn't be a button, it would be using the Not in List event of the combo. Seaching here on "notinlist" should turn up the two common methods.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33
    Thanks, pbaldy. The problem with the screen shots was probably due to me trying to remove, edit, and re-attach them. You may have looked at them while I was doing that. Fixed it. Now there is only one screen shot.

    I will look into the "notinlist" method. Thanks, yet again.

  4. #4
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33
    I checked out "NotInList" and don't see how to get it to do what I would like.

    I've attached two more screen shots for reference of what I would hope to accomplish.

    I'm attempting to be able to discover that a Part Number is not in the database yet, open up the form to create a new Part Number, close it, revert back to the main form (requeried) at the same record and then type in the new part number in the combo box.

    I already have the button and related form working. Just need help requering the main form and pulling up the original record that was being worked on.

    Suggestions?

    Attachment 6028 Attachment 6029
    Last edited by HeadGasket; 01-25-2012 at 03:26 PM. Reason: Left out detail

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Well, how it would work would be to replace your step 2. The user would type in the new part number into the combo, and if it didn't exist that event triggers a process to add it. The user wouldn't need to go click a button. If you want to use your button, you could adapt this:

    http://www.baldyweb.com/Requery.htm

    to go back to the record after the requery.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    By the way, have you tried just requerying the combo rather than the whole form? If that's all that's needed, it should leave you on the same record.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33
    I tried just doing the requery on the combo box but still can't get it to work. Perhaps I don't understand the proper format.

    Here is what I tried in the On Got Focus of the combo box:

    Private Sub PNID_GotFocus()
    Me.Requery
    End Sub

    ......and tried this as well

    Private Sub PNID_GotFocus()
    Requery
    End Sub

    Both of them cause the view to go back to record #1. I'm stumped. Will keep digging through the forum and Google.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    Me.ComboName.Requery
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33

    Solved

    Thanks again, pbaldy! Works like a charm. Such a simple solution.

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem! "Me" refers to the form, so whatever event you might use it in, it still refers to the form, not the control the event is for.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33
    Somehow I messed up the "Solved" step and can't seem to add it to the original post so everyone sees it has been solved. Oops.

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Gotcha covered.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 11-21-2011, 07:58 AM
  2. Replies: 5
    Last Post: 11-11-2011, 11:06 AM
  3. Open Form and Close Previous Form
    By gerrymouse1 in forum Forms
    Replies: 3
    Last Post: 04-19-2011, 05:42 AM
  4. Edit record in form with original entry shown
    By erknoebe in forum Access
    Replies: 5
    Last Post: 09-29-2010, 02:33 PM
  5. Replies: 3
    Last Post: 01-14-2010, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums