Results 1 to 8 of 8
  1. #1
    mlm is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    9

    Return blank results in query when field is fed by a look-up relationship

    Hi,


    I'm still learning the basics, but I have a table with several fields being fed through look-up relationships using a combo-box on the associated form. So, my main table is "EventList", which includes "StateNum" and "CountryNum" fields. I have a "StateList" and "CountryList" table where the combo-box on my form finds the info to populate itself. The selections on the form are then stored in the associated fields in the "EventList" table. My problem is that I am not requiring these fields to be filled in, but when I run a query, unless both the "StateNum" and "CountryNum" fields have info, the record isn't pulled by the query. From the troubleshooting I've done, it seemed to indicate that it was a problem with the Join Type of the relationships linking the StateList and CountryList tables to the EventList fields. From what I can tell, the selection should be "Include ALL records from 'StateList' and only those records from 'EventList' where the joined fields are equal" and the similar one for the countries. But, I have tried this and vice versa without success. I still only get the records where both fields are filled in. Any thoughts on this?

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Show the query SQL for analysis.

    Probably need to use wildcards.
    Review this tutorial http://datapigtechnologies.com/flash...tomfilter.html
    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
    mlm is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    9
    Thanks for the help, that tutorial was very helpful. I will be looking it over for a second time and trying to update my query accordingly soon. In the meantime, here is the query sql:

    SELECT PrincipalList.Salutation, PrincipalList.FirstName, PrincipalList.LastName, AgencyList.Agency, PrincipalList.Position, PrincipalList.Grouping, EventType.EventType, EventList.[Start Date], EventList.[Multi-Day Event?], EventList.[End Date], EventList.[Confirmed?], EventList.City, StateList.State, CountryList.Country, EventList.Description, EventList.Link, EventList.ID
    FROM StateList INNER JOIN ((AgencyList INNER JOIN PrincipalList ON AgencyList.[ID] = PrincipalList.[Agency]) INNER JOIN (EventType INNER JOIN (CountryList INNER JOIN EventList ON CountryList.[ID] = EventList.[CountryNum]) ON EventType.[ID] = EventList.[EventTypeNum]) ON PrincipalList.[ID] = EventList.[PrincipalNumber]) ON StateList.[ID] = EventList.[StateNum];

    There are many fields that I left out of the original description, so sorry for the clutter. Let me know what you think.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Probably want LEFT or RIGHT joins. Need WHERE clause.
    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
    mlm is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    9
    Thanks for the help. Could you help me out a little more with the SQL...I don't have any experience with it. I tried replacing all the inner joins with left joins but Access told me that it didn't support the join operation.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Want to provide db for analysis? 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.

  7. #7
    mlm is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    9
    Sorry for the delay in responding...I'm not sure I can remove all the confidential info so that I could send it. Would you have any general suggestions for setting the joins right?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I would need to work with data to analyse issue. If you can't get the query designer to accept the query might require multiple queries to get the final output.
    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.

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

Similar Threads

  1. Count query return zero instead of null/blank
    By dhicks19 in forum Queries
    Replies: 1
    Last Post: 04-19-2012, 07:52 AM
  2. Replies: 9
    Last Post: 03-09-2012, 02:55 PM
  3. Blank form on null query results
    By JackieEVSC in forum Forms
    Replies: 11
    Last Post: 11-30-2011, 08:39 AM
  4. Replies: 2
    Last Post: 08-05-2011, 01:24 PM
  5. Return blank field depending on quantity
    By anthonyjf in forum Access
    Replies: 1
    Last Post: 04-01-2009, 08:22 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