Results 1 to 11 of 11
  1. #1
    arothacker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    43

    Based on drop down value, form pops up displaying record clicked on

    I have a continuous form called Headcount with multiple fields and a drop down field called update. When the user selects the drop down for the record as "open"...is there a way for another form to pop up and display that particular record?



    The headcount form has locked fields but when the user chooses "open" we want to unlock the fields ID, Last Name, and First Name so that the user can edit only those particular fields and only when Open is selected.

  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
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Fields are "Locked" only on the form they are in, so that is not a problem.

    To answer your question, yes you can easily open another form when "Open" is selected. In the After Update event of the Dropdown control:

    Check if "Open" was selected in the dropdown - if not, exit the procedure.

    Open the editing form with:

    DoCmd.OpenForm formname, , , criteria, ,acdialog

    criteria is like a where clause (without the WHERE) that identifies the record you want to edit, and typically looks something like "CustomerID = me!Customer_ID" . me!Customer_ID is the value on the current record of your continuous form.

    acDialog is not required, but it's effect is to keep the user in the editing form until it is closed. No other actions outside the editing form can be done while it is open. It is a very useful feature.


    HTH

    John

  4. #4
    arothacker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    43
    That works perfectly! To add on, are we able to use the pop-up form to edit the record then? It allows me to edit it within the pop-up form but then doesn't save back to the original record.

  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
    It should save if it's bound to the same data. You may need to requery the original form to see the updated data.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    It probably does save back to the original record, but you just don't see it on the main form. To see the changes, you need to requery the main form after the popup closes.

    If you open the popup with the acDialog option, then you can add me.requery following the DoCmd.OpenForm.... line.

    That is another useful effect of the acDialog option - it stops the code until the popup form is closed.

    John

  7. #7
    arothacker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    43
    This is where it gets tricky because the form is based off filters from a query. So we have form #1 with drop downs such as location. The user selects location miami and then presses a button which opens form #2 that displays all the heads in miami. When the user selects "open" in the drop down field then form #3 opens. when I try to requery form #2 I get an error because of the filters I think


    ideally we want to have the form pop up and copy that record's data into the fields to make a new record but I haven't been able to figure that out yet...this was our alternative solution

  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

    DoCmd.OpenForm...
    Forms!FormJustOpened.TextboxName = Me.TextboxName

    If the form is opened in dialog mode, you'll need OpenArgs instead:

    http://www.baldyweb.com/OpenArgs.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    What is the error you get when you try to requery Form2? Where do you have the code, and what does it look like?

    The filters applied to Form2 should not cause an error when requerying it.

    One caveat though is that if you edit a record so that it no longer meets the filter criteria, then the requery will cause that record to seem to "disappear".

    John

  10. #10
    arothacker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    43
    Pbaldy - your solution worked perfectly!! I was looking into OpenArgs but couldn't find clear instructions on how to use it. Thank you!!

    John - the error I got was asking for one of the field values. I put the requery on form 2 when I think it might've worked if I put it on form 3 after the update.

    Thanks for all your help guys!! This has been stumping me for quite some time!

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    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: 5
    Last Post: 03-04-2014, 03:12 PM
  2. Access pops up briefly before Display Form
    By buttonsrtoys in forum Access
    Replies: 3
    Last Post: 05-05-2013, 12:07 PM
  3. Replies: 3
    Last Post: 12-30-2011, 01:20 PM
  4. Replies: 13
    Last Post: 11-08-2011, 11:57 AM
  5. Replies: 1
    Last Post: 11-09-2010, 03:02 PM

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