CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2006
    Posts
    392

    [RESOLVED] Date Comparsion in Formula field

    Hi am using Date Comparsion in Crystal Report selection Formula as

    if (strcmp({?Fromdate},'Nothing')=0 and strcmp({?Todate},'Nothing')=0) then
    (
    {Command.COMPANYID}={?CompanyId} and
    {Command.MODIFIEDDTTM}={Command.MODIFIEDDTTM} and
    {Command.CLASSIFICATION} = (if strcmp({?Classification},'Nothing')=0 then {Command.CLASSIFICATION} else {?Classification}) and
    {Command.MODIFIEDBY} = (if strcmp({?ModifiedBy},'Nothing')=0 then {Command.MODIFIEDBY} else {?ModifiedBy}) and
    {Command.FORMID} = if({?FormId}<> -1) then CDbl({?FormId})else{Command.FORMID}

    )
    else
    (
    {Command.COMPANYID}={?CompanyId} and
    {Command.MODIFIEDDTTM} <= CDateTime({?Todate}) and
    {Command.MODIFIEDDTTM} >= CDateTime({?Fromdate}) and
    {Command.CLASSIFICATION} = (if strcmp({?Classification},'Nothing')=0 then {Command.CLASSIFICATION} else {?Classification}) and
    {Command.MODIFIEDBY} = (if strcmp({?ModifiedBy},'Nothing')=0 then {Command.MODIFIEDBY} else {?ModifiedBy}) and
    {Command.FORMID} = if({?FormId}<> -1) then CDbl({?FormId}) else {Command.FORMID}

    )

    This formula currently showing records greater than todate. What I am doing wrong

    Thanks,
    VS 2005

  2. #2
    Join Date
    Sep 2006
    Posts
    392

    Re: Date Comparsion in Formula field

    No I found the issue...



    Replaced

    CDateTime



    with



    CDate



    This Solved the Issue
    VS 2005

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured