Results 1 to 5 of 5
  1. #1
    phil123 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    22

    Query criteria from combo box on form

    Hi,



    I have a few successful queries working in my database where the criteria under one of fields pulls from a combo box on a form.

    I am now looking to see if one combo box can be used for multiple criteria's in a query. Basically I have a few tables where a staff members name will appear next to a task. I want to be able to select this staff members name from a combo box and this retrieves all tasks where this persons name has been assigned.

    I think I may have read somewhere that a combo box cannot be used in this way - which seems so far to be the case. If I copy the code in the query into the different fields, the query doesn't run properly.

    Any suggestions as to how I get this to work?

    Thanks,

    Phil

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Yes, can be done. Did you try using OR operator?

    What do you mean by 'next to a task'? Post example of data.
    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
    phil123 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    22
    Hi June7,

    Thanks for your reply.

    By task I just mean that my database is being used to make sure that a number of different jobs relating to a process (in which our company carries out) and completed on time. By putting a name next to each of these I can ensure that each 'job' is accountable for and a search can easily be carried out

    At the minute I'm using the code [forms]![frmSearchbySeniorAdmin]![cboSeniorAdminName] within the query. On the search form there is then a command button which opens the display form and populates using the query.

    However if I copy this code above in to different fields in the query, it doesn't seem to work. How exactly would and OR operator be applied in this case (apologies my Access knowledge is still quite basic).

    Just to mention as well, these 'jobs' are recorded in different tables which are brought together via a series of subforms. All are linked together via the ID number. Don't know if this information is helpful or not.

    Many thanks,

    Phil

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Really just more confusing. Why would jobs be in different tables? Provide sample data. Or the db. Follow instructions at bottom of my post.
    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.

  5. #5
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    Need a lot of info here to get an understanding of what you have and what you are trying to accomplish.
    We would need:
    Table names and field names in all tables
    Picture of relationships (this would actually cover above requirement)
    Pictures of your forms and subforms
    Recordsources for above forms and subforms
    Rowsources of the combo boxes.
    And perhaps more if above leads to more questions.

    So, as June7 suggested, it would be easier to provide a zipped copy of your database which would include all of the above and more.

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

Similar Threads

  1. Query criteria from combo box of a form
    By kkbharat in forum Queries
    Replies: 11
    Last Post: 04-04-2018, 04:52 PM
  2. Replies: 11
    Last Post: 09-03-2015, 11:12 AM
  3. Form Combo as Query Criteria
    By SteveApa in forum Forms
    Replies: 1
    Last Post: 01-16-2015, 08:21 AM
  4. Replies: 3
    Last Post: 07-11-2014, 08:24 AM
  5. Replies: 9
    Last Post: 06-04-2014, 10:45 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