Results 1 to 6 of 6
  1. #1
    ConfusedDatabaseDesigner is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    11

    Question Query filter isn't filtering?

    Hello,



    I'm creating a query from two tables, one parent and one child. I created a filter on a field taken from the child table (a date field, if that matters) and put "Is Null" (I didn't actually type in the "" symbols, though) in the query criteria box of this field so that only records with a blank value in that field will show up. However, when I run the query, there's a record that appears with date in that field. What's up with that? Could it be that records that are not null are appearing anyways if they have a 'sister' record that is null (that is, they share the same parent record)? Is this fixable?

    Thanks in advance for your help!
    Last edited by ConfusedDatabaseDesigner; 07-11-2012 at 02:09 PM. Reason: Clarification

  2. #2
    Jester0001 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Location
    Indiana
    Posts
    69
    I just tried to replicate this using two tables (a parent and child), and filtering on a date field where it Is Null. I couldn't replicate the problem you described. Could you provide more info, such as the SQL, screenshots, or uploading the db for more analysis?

  3. #3
    ConfusedDatabaseDesigner is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    11
    At the moment I can't provide you with a copy of the database because it contains confidential information. I've copy/pasted the SQL info here, but if that's not helpful let me know and I'll try to provide a data-less version of the database when I can. I should warn you that unfortunately I know next to nothing of coding, SQL, VBA, and general database design, so this is probably very sloppy. If it is confusing or doesn't make sense, let me know and I'll try to explain what I'm trying to achieve as best as I can.

    SELECT [Participants - Basic Info].[Participant ID] AS [Participants - Basic Info_Participant ID], [Participants - Basic Info].[First Name], [Participants - Basic Info].[Last Name], [Participants - Basic Info].DOB, [Participants - Basic Info].Gender, [Participants - Basic Info].[Permitted to contact?], [Participants - Basic Info].[If not, why?], [Participants - Basic Info].[Recruited From], [Participants - In Lab].[Participation ID], [Participants - In Lab].[Participant ID] AS [Participants - In Lab_Participant ID], [Participants - In Lab].Project, [Participants - In Lab].[Last contacted on], [Participants - In Lab].[Last contacted by (netid)], [Participants - In Lab].[Participation Date], Round(((Date()-[DOB])/365.25),2) AS Age
    FROM [Participants - Basic Info] LEFT JOIN [Participants - In Lab] ON [Participants - Basic Info].[Participant ID] = [Participants - In Lab].[Participant ID]
    WHERE ((([Participants - Basic Info].[Permitted to contact?])="Only email contact") AND (([Participants - In Lab].[Participation Date]) Is Null)) OR ((([Participants - Basic Info].[Permitted to contact?])="Not yet")) OR ((([Participants - Basic Info].[Permitted to contact?])="Permitted"));

    Thanks SO much for your time, it is truly appreciated!!

  4. #4
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Hi there,

    In your WHERE clause, you have:

    (([Participants - In Lab].[Participation Date]) Is Null)) OR ((([Participants - Basic Info].[Permitted to contact?])="Not yet")) OR ((([Participants - Basic Info].[Permitted to contact?])="Permitted"));

    Should you be using And instead of Or?

    If [Permitted to contact?] ="Not yet" in a particular record, then that record will be returned whether [Participation Date] Is Null or Is Not Null. Likewise if [Permitted to contact?]="Permitted".

    Hope this helps.

  5. #5
    ConfusedDatabaseDesigner is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    11
    Thanks so much, Kirsti! It works very well now

  6. #6
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Glad to hear it.

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

Similar Threads

  1. Filtering with Criteria in SQL Query?
    By Huddle in forum Reports
    Replies: 44
    Last Post: 10-21-2013, 02:11 PM
  2. Filtering and using First() inside a query
    By Gilligan in forum Queries
    Replies: 17
    Last Post: 03-10-2011, 05:52 PM
  3. Filtering a Query
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 06-03-2010, 01:46 PM
  4. Filtering a Query
    By jbarrum in forum Access
    Replies: 1
    Last Post: 11-20-2009, 03:03 PM
  5. Filtering recs from query ...
    By rfhall50 in forum Forms
    Replies: 0
    Last Post: 02-18-2009, 09:40 AM

Tags for this Thread

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