locked
search multiple fields with one textbox access 2007 RRS feed

  • Question

  • Greetings all,

    i am still new to access and i started my work using access 2016 but i needed to transfer this work to access 2007 while i am rebuilding everything from scratch I had a problem with a search button in a form (macro) that used to look like so in access 2016

    [Item Code] Like "*" & [Forms]![Active medication list]![Text126] & "*" Or [Description] Like "*" & [Forms]![Active medication list]![Text126] & "*"

    Where Text126 is the field i am going to enter the values i want to search for and [Item Code] , [Description] is the fields to search in.

    Also i used a like to make it more flexible 

    But when i tried the same in access 2007 it won't work 

    Here are the solutions

    1. i tried changed all " to '  

    2. added = at the beginning

    3. made sure that i selected the <value> in expression builder

    looked online for solution nothing worked what i am missing?

    Any help would be appreciated guys


    • Edited by Mah.Elsheikh Thursday, August 3, 2017 6:28 AM added something
    Thursday, August 3, 2017 6:27 AM

All replies

  • Greetings all,

    i am still new to access and i started my work using access 2016 but i needed to transfer this work to access 2007 while i am rebuilding everything from scratch I had a problem with a search button in a form (macro) that used to look like so in access 2016

    [Item Code] Like "*" & [Forms]![Active medication list]![Text126] & "*" Or [Description] Like "*" & [Forms]![Active medication list]![Text126] & "*"

    Where Text126 is the field i am going to enter the values i want to search for and [Item Code] , [Description] is the fields to search in.

    Also i used a like to make it more flexible 

    But when i tried the same in access 2007 it won't work 

    Here are the solutions

    1. i tried changed all " to '  

    2. added = at the beginning

    3. made sure that i selected the <value> in expression builder

    looked online for solution nothing worked what i am missing?

    Any help would be appreciated guys


    Well i found a way around it:

    1. I opened the database in access 2016 then applied the macro the way i know it then saved the form.

    2. opened the file in access 2007 i found it added XmL lines.

    3. my question is what happened here and why? i really need to know what these Xml lined added to the functionality. specially that the where clause is still the same

    _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
    <UserInterfaceMacro For="Command150" Event="OnClick" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><Statements><Action Name="ApplyFilter"><Argument Name="Where">

    _AXL:eCondition">[Item Code] Like "*" &amp; [Forms]![Active medication list]![Text148] &amp; "*"</Argument></Action></Statements></UserInterfaceMacro>


    • Proposed as answer by Chenchen Li Friday, August 4, 2017 8:19 AM
    Thursday, August 3, 2017 3:45 PM
  • Hi,

    If you're planning on using the database in Access 2007, I recommend not making any design changes using Access 2016.

    Have you tried re-creating the macro in Access 2007?

    Just curious...

    PS. Are you talking about Data Macros? If so, I don't think they exist in Access 2007.

    • Edited by .theDBguy Thursday, August 3, 2017 4:04 PM
    Thursday, August 3, 2017 4:04 PM
  • Hello,

    As theDBguy said, UI macro starts from Access 2010. If you want to use Access 2007, I suggest you re-create the macro in Access 2007.

    Since you have fixed the issue, I suggest you mark your post as answer to close this thread.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 4, 2017 8:19 AM