Results 1 to 4 of 4
  1. #1
    NGFLNG1 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2014
    Posts
    16

    Performing Searches Form using two separate tables

    Hi All,



    I have a form derived from two different tables. The "contacts" table is the main table and the "Appointments" is the secondary table. It is used to track the appointments of employees.

    I have added search functionality via a command button with an event procedure using a "Private sub-routine" that I got from the forum. The event works fine for the "contacts" table search. However, I cannot get it to work for the secondary table. I have modified the 'If Else' routines to match the field I want to search on--but it does not work.

    My form displays one employee/contact at a time with all of their appointments linked to them.

    Question: Is it possible to search the form for information from both tables using the same search button in the header section of the form? Right now, it does not do anything when I search for a particular appointment (the child form).

    Ex: I want to search for an appointment from a txt field using "certifying Officer" as the terms to search. I enter this information into the search box, hit the search button, and the employee with an appointment that matches those terms should come up, along with all of their other appointments, if any.

    Thank you.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    This is a form/subform arrangement?

    What you want will not be simple.

    Couldn't there be multiple contacts having appointments with the same certifying officer?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    NGFLNG1 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2014
    Posts
    16
    Yes. More than one employee may possibly have the same appointment. Each appointment has a PK (of course), description (short text), and an Appt Number (short txt).

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    User selects certifying officer, code applies filter criteria to main form where contacts have that certifying officer.

    A query would look like:

    SELECT * From Contacts WHERE ContactID IN (SELECT ContactID FROM Appointments WHERE OfficerID=Forms!formmain![tbxCriteria]);

    Translating this to a dynamic search on a form that allows for any field and parameters in the subquery would be complicated. I've never tried this.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 07-18-2014, 02:04 AM
  2. Replies: 5
    Last Post: 03-31-2014, 02:26 PM
  3. Performing calculations in a form
    By Demerit in forum Forms
    Replies: 9
    Last Post: 12-12-2013, 10:54 AM
  4. Replies: 13
    Last Post: 06-05-2012, 10:46 AM
  5. Performing calculations in the form.
    By mulefeathers in forum Forms
    Replies: 4
    Last Post: 12-07-2011, 10:47 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