Results 1 to 4 of 4

Thread: [RESOLVED] Whats the problem with this expression?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    95

    Resolved [RESOLVED] Whats the problem with this expression?

    i am using VBnet 2002 and crystal v9.1
    Please I am trying to define an expression in my crystal report but still having errors , Can you help me please???
    below is my code,please advice accordingly ;
    VB Code:
    1. Local StringVar message := "";
    2. Local Datevar confdate ={pensioners.date_conf_pens_terms};
    3. Local Datevar hiredate ={pensioners.hiredate};
    4.  
    5. if hiredate = confdate then
    6. message="N/A"
    7. ELSE
    8. confdate
    I simply want to display a message "N/A" on the report when dates are equal and confdate when otherwise.
    Please help.

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

    Re: Whats the problem with this expression?

    What are the error messages?

    You need to use := when assigning values to variables.
    Based on the IF statement the Formula returns either a string or a date. This is not allowed. A formula can only return 1 datatype.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    95

    Re: Whats the problem with this expression?

    Thanks for the message.I have tried to make some changes to my code as you suggested but still am having an error message"The remaining text doesnt appear to be part of the formula" it highlights almost the whole code.below is the code
    VB Code:
    1. Local StringVar message := "";
    2. Local Datevar confdate :=cstr{pensioners.date_conf_pens_terms};
    3. Local Datevar hiredate :=cstr{pensioners.hiredate};
    4. if hiredate = confdate then
    5. message="N/A"
    6. ELSE
    7. confdate

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

    Re: Whats the problem with this expression?

    try

    message := "N/A"

    but do you even need the local variables

    Code:
    If {pensioners.hiredate} = {pensioners.date_conf_pens_terms} Then
       "N/A"
    Else
        ToText({pensioners.date_conf_pens_terms})

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