Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Ah - perhaps we're just at cross purposes. In the attributes table there are 2 records for ID=2259



    Constituent ID Constituent Specific Attributes Contact Preferences Import ID Constituent Specific Attributes Contact Preferences Description Constituent Specific Attributes Contact Preferences Date Constituent Specific Attributes Contact Preferences Comments
    2259 00001-528-0000449513 Email opt out 02/11/2016 Bounced
    2259 00001-528-0000046474 Email opt in


    As one of these has no date it appears in my query results.
    Similarly for other IDs with a null date record

    So my query correctly does what I thought you described in post 1

    BUT you want only those IDs where there are no duplicates AND then from that list filter again to only show those where the date field is NULL.
    Not the same thing!

    Yes, that does have 1175 records & can easily be done with one query

    Code:
    SELECT Attribute.[Constituent ID], Attribute_1.[Constituent Specific Attributes Contact Preferences Import ID], Attribute_1.[Constituent Specific Attributes Contact Preferences Description]FROM Attribute AS Attribute_1 INNER JOIN Attribute ON Attribute_1.[Constituent ID] = Attribute.[Constituent ID]
    WHERE (((Attribute_1.[Constituent Specific Attributes Contact Preferences Date]) Is Null))
    GROUP BY Attribute.[Constituent ID], Attribute_1.[Constituent Specific Attributes Contact Preferences Import ID], Attribute_1.[Constituent Specific Attributes Contact Preferences Description]
    HAVING (((Count(Attribute.[Constituent ID]))=1));
    Click image for larger version. 

Name:	Capture.PNG 
Views:	9 
Size:	30.0 KB 
ID:	34048

    NOTE: I still haven't looked at the alternative 3 step solution
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  2. #17
    Antonio is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    37
    Ah yes this works now, but I don't understand why you had to join the datasets twice (rather than just once as I was trying to do)....it might be something to do with not being able to combine the Count for constituent ID with Date=Null (because the count, as a total works, because it returns one answer per constituent, but when combining with Dates, because you can have multiple dates per record, it doesnt like it)....anyway it works and its handy to know because I can cut the 3 queries down to 1 in future.


    Thanks again Colin.

    Antonio

  3. #18
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Quote Originally Posted by Antonio View Post
    Ah yes this works now, but I don't understand why you had to join the datasets twice (rather than just once as I was trying to do)....it might be something to do with not being able to combine the Count for constituent ID with Date=Null (because the count, as a total works, because it returns one answer per constituent, but when combining with Dates, because you can have multiple dates per record, it doesnt like it)....anyway it works and its handy to know because I can cut the 3 queries down to 1 in future.


    Thanks again Colin.

    Antonio
    Sounds like you are now interpreting this the way I did originally.
    You only need to use the table once to identify IDs where there is only one record without a date (my original solution)

    However you wanted to get all IDs where there were no duplicates AND then filter that list for those with no date.
    Each part needs a separate copy of the table OR a separate query.

    How are you getting on with what you called 'the big one'?
    I haven't done any more to it and won't be able to do so for a couple of days at least
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 1
    Last Post: 07-21-2016, 02:24 AM
  2. Replies: 12
    Last Post: 12-27-2015, 02:17 PM
  3. Replies: 1
    Last Post: 07-30-2015, 05:03 AM
  4. Query To Add Empty Records To Dataset?
    By kestefon in forum Access
    Replies: 5
    Last Post: 08-01-2014, 11:48 AM
  5. Selecting Unique SETS of rows in Access Query
    By dalessandroh in forum Queries
    Replies: 0
    Last Post: 11-09-2010, 10:42 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