Results 1 to 3 of 3
  1. #1
    zb134 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    May 2012
    Posts
    6

    Question Running a query OnChange

    Hi I pretty new to access...I am creating a form where it would show up the employees assigned to a particular supervisor.
    The supervisor is selected using a drop down list. I want to use the selected supervisor to run a query to find the corresponding employees.
    However, I can't figure how to actually run the query. I tried entering this
    Code:
    SELECT EmployeesList.[First Name], EmployeesList.[Last Name], EmployeesList.Supervisor FROM EmployeesList WHERE (((EmployeesList.Supervisor)=[Forms]![AssignmentsBysup]![SupervisoSelection]]));
    in the On Change filed but that gives an error.

    Please help

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Where is that SQL used? That it is red suggests you tried it in a VBA procedure.

    A SELECT sql is used in VBA to open a recordset. Just the statement standing alone can do nothing but error.

    Review this tutorial for one method to filter form http://datapigtechnologies.com/flash...tomfilter.html

    And from the same site http://datapigtechnologies.com/AccessMain.htm review the 3 on comboboxes in the Access Forms: Control Basics section.
    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
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    Without knowing more about your project here's a step in the right direction. On your form you have 2 controls 1 is a combo box with the source as your list of Supervisors. the second is a list box with your SQL Statement as your RowSource in the onchange event of the combobox have the listbox refresh. You'll have to work out the details yourself.

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

Similar Threads

  1. Query with a running sum
    By is49460 in forum Queries
    Replies: 3
    Last Post: 09-07-2013, 11:11 PM
  2. AfterUpdate/OnChange not working
    By ccordner in forum Forms
    Replies: 1
    Last Post: 02-08-2012, 11:58 AM
  3. Add date OnChange Event - A to Z Walk Through
    By JeffG3209 in forum Programming
    Replies: 7
    Last Post: 08-12-2011, 04:40 PM
  4. Running a query
    By scarlettera in forum Queries
    Replies: 3
    Last Post: 04-04-2011, 01:59 PM
  5. Replies: 1
    Last Post: 06-22-2010, 03:15 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