Results 1 to 2 of 2
  1. #1
    ramindya is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    20

    Count number of days

    Hello:

    I have a table tblCallLog which has a field called "Calldate".

    I need to calculate number of counts of days which meets the following condition:



    Currentdate - Calldate <= 60

    This is the Sql "qryPhone1calllog" I tried but it does not work..

    SELECT tblCallLog.CCSSID, tblCallLog.CallPhone1 AS Phone, tblCallLog.Day, tblCallLog.calldate,tblCallLog.LM, tblCallLog.notes, IIf((Date()-[calldate])<=60,[calldate],Null) AS PhoneC, tblCallLog.AppointAmPm, tblCallLog.CallType
    FROM tblCCSSExpansionTrackingMain AS M LEFT JOIN tblCallLog ON [M].CCSSID=tblCallLog.CCSSID
    WHERE (((tblCallLog.CallPhone1)=Forms![frmCallTrack-Cases]!CONTPHONE1) And ((M.CCSSID)=Forms![frmCallTrack-Cases]!CCSSID))
    ORDER BY tblCallLog.Seq_Num;

    and in the controlsource propoerty I mentioned =DCount("[PhoneC]","qryPhone1CallLog","CCSSID=Forms![frmCallTrack-Cases]!CCSSID")

    Can you let me know the issue ? 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,945
    Need to concatenate variables in the WHERE CONDITION argument, not place within quotes. Reference to form control/field is a variable:

    =DCount("[PhoneC]","qryPhone1CallLog","CCSSID=" & Forms![frmCallTrack-Cases]!CCSSID)

    Assumes CCSSID is a numeric value. If it is text, need apostrophe delimiters (dates need #).

    =DCount("[PhoneC]","qryPhone1CallLog","CCSSID='" & Forms![frmCallTrack-Cases]!CCSSID & "'")
    Last edited by June7; 02-23-2012 at 01:26 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.

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

Similar Threads

  1. Number of Days between visits
    By gstullo in forum Queries
    Replies: 5
    Last Post: 12-19-2011, 10:08 AM
  2. Count days past a set date
    By tsn.s in forum Access
    Replies: 2
    Last Post: 12-01-2011, 09:49 AM
  3. Replies: 6
    Last Post: 07-25-2011, 01:54 PM
  4. number of days query
    By osuprog in forum Queries
    Replies: 15
    Last Post: 09-17-2010, 01:15 PM
  5. Replies: 4
    Last Post: 08-27-2009, 01:21 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