Results 1 to 2 of 2

Thread: [RESOLVED] Code Error help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Location
    Madison, WI
    Posts
    136

    Resolved [RESOLVED] Code Error help

    I want to show a blank if a date equals 01/01/2099. Here is the code I have now, but I am getting an error saying a date time is required here and it highlights the last line of the code, but if I put a date time at the end then it says string requierd here. What is wrong with the end of the code?
    If "$" + {ACH.Amount} = {@currentACH} And {ACH.Starting} < CurrentDate And {ACH.Ending} > CurrentDate Then
    {ACH.Ending}
    Else If "$" + {ACH.Amount} = {@currentACH} And {ACH.Starting} < CurrentDate And {ACH.Ending} = Date(2099,01,01) Then
    ""
    Else If "$" + {ACH.Amount1} = {@currentACH} And {ACH.Starting1} < CurrentDate And {ACH.Ending1} > CurrentDate Then
    {ACH.Ending1}
    Else If "$" + {ACH.Amount1} = {@currentACH} And {ACH.Starting1} < CurrentDate And {ACH.Ending1} = Date(2099,01,01) Then
    ""
    Else If "$" + {ACH.Amount2} = {@currentACH} And {ACH.Starting2} < CurrentDate And {ACH.Ending2} > CurrentDate Then
    {ACH.Ending2}
    Else If "$" + {ACH.Amount2} = {@currentACH} And {ACH.Starting2} < CurrentDate And {ACH.Ending2} = Date(2099,01,01) Then
    ""
    Else If "$" + {ACH.Amount3} = {@currentACH} And {ACH.Starting3} < CurrentDate And {ACH.Ending3} > CurrentDate Then
    {ACH.Ending3}
    Else If "$" + {ACH.Amount3} = {@currentACH} And {ACH.Starting3} < CurrentDate And {ACH.Ending3} = Date(2099,01,01) Then
    ""
    Else If "$" + {ACH.Amount4} = {@currentACH} And {ACH.Starting4} < CurrentDate And {ACH.Ending4} > CurrentDate Then
    {ACH.Ending4}
    Else If "$" + {ACH.Amount4} = {@currentACH} And {ACH.Starting4} < CurrentDate And {ACH.Ending4} = Date(2099,01,01) Then
    ""
    note: I am using Crystal syntax.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Code Error help

    A Forumla can only return 1 type of data. This code is returning either a Date or a String.

    Use the ToText function to convert the Dates to strings.

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