Results 1 to 3 of 3
  1. #1
    claysea is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    20

    Want Access to return "Yes" if any of "Service Dates" fall in August

    I have a main client table with a linked services sub-table. I want my report to indicate a "Yes" if a specific client had any services for August and "No" if they haven't. Some clients will have 8 services for August and some will have none. I have researched to my wits end and came up with a bunch of duds. This was my latest disaster (all the answers returned were No...and that is not true).

    =IIf([Date of Service]=Month(Now()-1),"Yes","No")

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Could try domain aggregate function, like:

    =IIf(Not IsNull(DLookup("[ClientID]","tablename","ClientID=" & [ClientID] & " AND Month([Date of Service])=" & Month(Date())), "Yes", "No")

    or

    =IIf(DCount("[ClientID]","tablename","ClientID=" & [ClientID] & " AND Month([Date of Service])=" & Month(Date())>0, "Yes", "No")

    When will you run this report? If you run it on 1st of month do you really want to search records for the previous month instead? If you want to be able to run the report IN any month FOR any month, then need dynamic input parameter to filter the report and for the domain aggregate function.
    Last edited by June7; 11-14-2012 at 07:13 PM.
    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
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    What does the data in [Date of Service] look like? Is it a date?

    Today, Month(Now()-1) will equal 10. Is that what you want or do you want August?

    If you are looking for records in last month (from this month) and [Date of Service] has dates , I would try:

    Code:
    =IIf(Month([Date of Service]) = Month(Date()-1),"Yes","No")
    (Also, you shouldn't use spaces, special characters (except the underscore) or reserved words in object names)

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

Similar Threads

  1. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  2. Replies: 3
    Last Post: 06-29-2012, 08:54 AM
  3. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  4. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  5. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 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