Results 1 to 6 of 6
  1. #1
    h_rainier is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    3

    Queries and Listboxes

    Dear Community:

    This is my first post, and I am sorry if it is a bit repetitive. I have read quite a few entries on this in this website, as well as in others, but I cannot understand the language of the explanations. So, please, if you respond, please pretend you are dealing with a high school graduate with no programming background, but who is eager and ready to learn. Step-by-step, please! I tried to attach the file, but it is larger than the forum allows.

    I am building a database that compiles several types of information in a table. That information is:

    - Operation Type (there are 10, listed in a table named "OP")
    - State (there are 27, listed in in a table named "UF")
    - Citation to a Legal document (text, 100 chars)
    - Notes (100 chars)
    - Variation (checkbox, y/n)
    - Legal Language (memo)

    I have a form ("content"), with a button that opens up another form ("QF2", pop-up) asking for a state (listed in a listbox called UFlist) and an operation (OPList). Both lists are extended. I would like a query to feed off of the user selection in that form. Here's what I have done.

    I created a query (MainQuery), and entered the following in the operation field criteria: [Forms]![QF2]![OpList]. I also entered [Forms]![QF2]![UFList] in the "Or" category. Ideally, I should be able to pull information from all states regarding one type of operation, or all operations in one state.



    I get nothing but blank results when I make my selection and run the query. Why?! Even when I select all states and all operations, nothing comes through. Do I have to enter some VB language somewhere to get this to work? Can you explain where and what exactly?

    Thank you so much for your input, and remember, I am challenged, but I learned all I know so far on my own...

    h_rainier

  2. #2
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    Without looking at your query or database I am making a couple of presumptions here. My comments are based on those presumptions. First I'm betting that your query uses inner joins something like

    Select a.*,b.* from a inner join b on a.id = b.id

    When you do this the field joined must be present in both tables. If the link isn't there in 1 table no record is pulled. You have 6 tables If one of those tables does not have any matching record your query will perform as you stated returning 0 records. Secondly if all tables have records but the field you're linking on does not match between the two tables again you will return 0 records. You will only return a record if the fields linked on have records in the other table that match.

  3. #3
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    That last part should have been "have records in both tables that match"

  4. #4
    h_rainier is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    3

    Here's the attached file.

    Ray:
    Thank you for such a quick response. I am trying to attach the file so you can take a look at it, if you have time.
    I'm also trying to make the change you suggested.

    Rainier
    Attached Files Attached Files

  5. #5
    h_rainier is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    3
    Ok, I looked at the SQL view of the query, and it shows this:

    SELECT Content.Operation, Content.State, Content.Citation, Content.[Legal Language], Content.Variation, Content.Notes
    FROM Content
    WHERE (((Content.Operation)=[Forms]![QF2]![OpList]));



    I'm not sure how to link the table to the form, or the query... Maybe that's what's missing. I created two tables to populate the State (UF) and Operations (OP) fields, and I also used that table to populate the listboxes.... I'm sorry, I'm trying to be more direct and open, but I'm not sure how I can do that!!!

  6. #6
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    Here's the problem your combo box is a multi select combo box. When using a multi select combo box the selected elements are in a collection when you use the criteria Forms!QF2!oplist your getting the value not the collection and the value is blank so you're getting 0 records. I rarely use multi-select combo boxes or listboxes so someone else would be better qualified to help you. Last time I used one was at a previous employer and I don't have access to the code I used.
    Maybe someone with more familiarity can point you in the best way to do this.

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

Similar Threads

  1. Connected Listboxes
    By brc in forum Queries
    Replies: 2
    Last Post: 07-08-2011, 09:22 AM
  2. how to edit listboxes?
    By RedGoneWILD in forum Programming
    Replies: 2
    Last Post: 08-23-2010, 11:53 AM
  3. dropdowns and listboxes
    By t_dot in forum Forms
    Replies: 6
    Last Post: 08-19-2010, 11:12 AM
  4. Multiple Listboxes
    By Butterflies88 in forum Forms
    Replies: 1
    Last Post: 02-11-2009, 10:16 PM
  5. Listboxes in Reports
    By bonekrusher in forum Reports
    Replies: 1
    Last Post: 09-21-2006, 01:46 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