Results 1 to 4 of 4
  1. #1
    rbw95662 is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    4

    Find records based on a field in a form

    Hi -

    I have two tables: Employers & Employees. They are joined by the EmployerID field in both tables.

    I have two forms: One is a split form that shows the records in the Employer table and the other form shows the records in the Employee table.

    On the split form I want the user to click on the employerID field and then the second form will be displayed with only the employee's that have the same EmployerID.

    I've tried using an embedded macro:

    OpenForm
    Form Name: frm_ListofEmployees
    View: Form
    Filter Name:
    Where Condition: =[EmployerID]


    Data Mode:
    Window Mode: Normal

    and I tried a query using the criteria:

    [Forms]![frm_ListofEmployees]![EmployerID]=[Employer]![EmployerID]

    with no success. The macro displays all the employee records and query displays no records.

    I would appreciate any and all suggestions.

    Thanks - Rick

  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
    Here's the VBA method:

    BaldyWeb wherecondition

    I don't use macros, but that syntax seems off; you need to specify the field to filter on and where to find the value. If you want to stay with the macro, check in help for the required syntax.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rbw95662 is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    4

    It worked

    Paul - Your example worked perfectly. Thank you - Rick

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem Rick; glad it helped.
    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. split form select records based on a criterea
    By ramkitty in forum Access
    Replies: 8
    Last Post: 03-12-2010, 06:19 PM
  2. Autofill form fields based on another field
    By ljs1277 in forum Access
    Replies: 3
    Last Post: 02-16-2010, 02:51 PM
  3. Replies: 1
    Last Post: 11-10-2009, 03:20 PM
  4. Replies: 4
    Last Post: 07-22-2009, 02:33 PM
  5. Replies: 0
    Last Post: 06-23-2009, 03:01 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