Results 1 to 5 of 5
  1. #1
    aligahk06 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    94

    Search command in form

    Dear All,




    I want a vba code on a command button in a form that serach based on either name or company name.
    Table:TelephoneList
    Field : Name , company


    TelephoneList.[Name], TelephoneList.[Company]


    While clicking the button it ask for either enter name or company name and pull records based on input name or company name
    corresponding the name or company name.
    Please help,


    Rgds,
    aligahk06

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Quote Originally Posted by aligahk06 View Post
    Dear All,


    I want a vba code on a command button in a form that serach based on either name or company name.
    Table:TelephoneList
    Field : Name , company


    TelephoneList.[Name], TelephoneList.[Company]


    While clicking the button it ask for either enter name or company name and pull records based on input name or company name
    corresponding the name or company name.
    Please help,


    Rgds,
    aligahk06
    Why not use a combo box instead of a button. Access wizard will even write the code needed in the After Update event of the combo box
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Note that "NAME" is a reserved word in Access and shouldn't be used for object names

  4. #4
    aligahk06 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    94
    Dear Sir Steve,

    I changed it to empName,
    So it become TelephoneList.[empName]

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Much better!

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

Similar Threads

  1. Replies: 1
    Last Post: 07-05-2020, 12:03 AM
  2. SQL command in a search form.
    By agh5147 in forum Access
    Replies: 4
    Last Post: 06-19-2017, 12:09 PM
  3. Replies: 1
    Last Post: 05-06-2015, 01:23 PM
  4. Replies: 3
    Last Post: 03-29-2015, 07:42 PM
  5. Replies: 11
    Last Post: 02-22-2015, 01:25 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