Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23

Macro to open form with data as specified in unbound text bx in another form.

  1. #16
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    21

    Hi, Ive set up the search box exactly the same way as the Chemical name one. I've re-typed the code in but it's still not working.
    This is the code for the chem name search DoCmd.OpenForm "basicFm", , , "ChemicalName Like '*" & Me.ChemicalSearchBx & "*'"
    And this is the code for the formula search DoCmd.OpenForm "basicFm", , , "FormulaTXTBx Like '*" & Me.FormulaSearchBx & "*'"
    When I click on the chem search it works fine, opening the basic form with the correct info but when I try the formula one it opens a Enter parameter value pop up box, then even if I put a formula in there it opens the same basic form with the wrong info.
    What am I missing?

  2. #17
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,719
    FormulaTXTBx sounds like the name of a textbox; it needs to be the name of the field in the form's record source you want the filter applied to.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #18
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    21
    Thanks. The FormulaTXTBx is the same unbound text bx type as the ChemicalName box. So it's the box in my basic form that is linked to the formula field in my table, the same way the ChemicalName is the box that is bound to that field in my table. I don't understand how they are different?

  4. #19
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,719
    It needs to be the name of the field in the table, not the name of the textbox. The field you want the value in the textbox filtered on. In the working one you have ChemicalName, not ChemicalSearchBx.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #20
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    21
    Ahha! thanks.

  6. #21
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,719
    No problem. Got it working I take it?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #22
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    21
    Yep and moved on to my next problem. lol Thanks for all your help, I think I understand the underlying links now.

  8. #23
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,719
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-07-2019, 01:51 AM
  2. Replies: 3
    Last Post: 07-19-2017, 12:40 PM
  3. Replies: 3
    Last Post: 03-19-2015, 02:11 PM
  4. Replies: 1
    Last Post: 08-20-2013, 02:17 PM
  5. Replies: 4
    Last Post: 04-22-2011, 03:08 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
  •  
Tech Forums: Microsoft Office Forums