Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    jcrump230 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12

    User select queries

    first and foremost I am a novice.......
    I have a form with several list boxes. I want my users to select a value in the list boxes to create query results. Sometimes I will need only certain list boxes on the form to create a query. I can use listbox1 ,3, 5 or 1,2,3 etc. If no value is selected in the other list boxes it will be bypass . Thanks in advance

    list box1 contains All and Id_numbers for each participant
    list box2 contains Primary address , secondary address and Both
    list box3 contains Male , Female
    List box4 contains dates


    List box5 contains email address(yes or no), telephone(yes or no) and Leave message(yes or no)
    etc.....................




    I have no problems getting the values in the list boxes. I use either value list or row source it from a table.
    Or provide me any other way to do the job

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    IMHO This sounds like an unusual request, so I'm wondering if there is a better way to achieve the desired results. Can you tell us more about the queries and the values in the list boxes.
    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
    jcrump230 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    Hi Bob,

    I thought that was the way to run queries. The user signs in and select the queries they want to see. Just my idea how it should run. I am assigned a project that have 700 participants. We are going to ship them a book one time and the equipment and a book next time.. There are 4 qtrs. each participant will participate in 2 qtrs. their name, address of availability either primary address or secondary address or both for the project, id number, equipment id number, availability dates, when items are shipped, returned date, phone, email address
    So we can send mail merge letter or email or make a phone calls for returned or not returned items or completed assignments. I have a availability grid that tells us when the participants are available and we will take that info and see if the 1st qtr, 2nd qtr, 3rd qtr or 4th qtr are suitable. All the records will be kept on each quarter they participant in. there will be batch shipments for each qtr(on certain dates). Hopefully this will help you out. Thanks for replying back. I am trying to visualize what is needed. right now I am testing things before the 700 or so come out. so I will be ready to go

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    I have some understanding now, but can you explain what you want to do/happen once you have finished making selections from the list boxes.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    jcrump230 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    I would like to click a button to Run a query after my selection(s) were made. then run a report or mailmerge

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Have you tried creating a query that references the list boxes on your form for its criteria.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    jcrump230 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    Bob,
    can I have a small example to get me going in the right direction

  8. #8
    jcrump230 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    I believe I have the first list box works nicely. for "All" it grabs all records, select a single record it grabs just the single record, if I select two records it grabs just the two records. Having two list boxes, the code wants me to select a item in the second list box no matter what which if I do not select "All" in the first list box I really do not want to select anything for the second list box. If a single record is selected in the first list box and I have to select from the second list box it will show no records.

  9. #9
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Take a look at the attached file.Also see post #2 at this link: http://www.access-programmers.co.uk/...arameter+query
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  10. #10
    jcrump230 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    thanks Bob. Its working with the combo boxes. I will try with the list boxes later. One problem I am having is "All". I have it in my combo box with Union select but I need the code for it to be recognized as ALL. what do I need to do to give you credit for helping me. thanks again
    Hopefully you will be around when I need more help

  11. #11
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by jcrump230 View Post
    thanks Bob. Its working with the combo boxes. I will try with the list boxes later. One problem I am having is "All". I have it in my combo box with Union select but I need the code for it to be recognized as ALL. what do I need to do to give you credit for helping me. thanks again
    Hopefully you will be around when I need more help
    And if I'm not then I am sure there will someone else who will step up to the plate. There are many here with far greater experience and knowledge than I have. Read the bit of my signature in red to give credit.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  12. #12
    jcrump230 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    One more thing, What do I need to do to get ALL selection to show all records. Right now, No records are showing up when selected. thanks

  13. #13
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    see this link for one way to add ALL to your options.
    Another way.

  14. #14
    jcrump230 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    Orange,

    I have ALL in my combo box but when I select the ALL item I get no records. I look at the link no help. what code do I need and where do I put the code...... thanks

  15. #15
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    You have to create code to do select all relevant records if the user chooses the "All" option.
    Here's a generic example:

    If user chooses "All" then Select all records..
    Else
    Select all records matching chosen user criteria
    ......
    end if

    eg.

    Code:
    .....  If me!combobox ="All" then
             mySQL = "SELECT * from myTable "
           Else
             mySQL = "Select * from myTable where mycriteria = Me.combobox
            end if...

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-17-2014, 06:30 PM
  2. Replies: 5
    Last Post: 05-14-2014, 01:17 PM
  3. Queries to select MAX
    By johnseito in forum Queries
    Replies: 20
    Last Post: 09-15-2013, 07:13 AM
  4. How do you select a field based on user input?
    By technesurge in forum Queries
    Replies: 5
    Last Post: 06-20-2012, 02:04 PM
  5. User functions within queries...
    By ChaosInACT in forum Queries
    Replies: 5
    Last Post: 01-19-2012, 06:39 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