IIf expressions in reports

Ramzess II

Registered User.
Local time
Today, 04:27
Joined
Apr 7, 2004
Messages
32
Hello!

I was wondering if somebody could help me on this:
I got this expression in control source of an unbound text box in a report:

="Phone: " & IIf([schGSM] Is Null;"";[schGSM] & ", ") & IIf([schPhone] Is Null;"";[schPhone])

As you see it concatenates two fields 'schGSM' and 'schPhone' and display nothing if fields are empty. Well normally one of those fields will always has a value but:

THE QUESTION IS, how can I make this expression to skip outputting text "Phone: " if both fields ('schGSM' and 'schPhone') are empty?

And another problem is: in the same report I have two fields to join in one where one field is a date field, formated as 'dd-mmm-yy'; When I join it with another field using the same expression mentioned above, the date is not shown as I formated before. Now it is 'dd.mm.yyyy';
I think it is Format I have to use in this expression, but I am not sure on how to, can anybody help me on this too, please?
 
Ramzess,

Code:
=IIf([schGSM] Is Null And [schPhone] Is Null,
     "",
     "Phone: " & IIf([schGSM] Is Null, 
                     "", 
                     [schGSM] & ", ") & IIf([schPhone] Is Null, 
                                            "",  
                                            [schPhone]))

Wayne
 
WayneRyan, Thank you!
I had to know that... it really is so simple... I am ashamed :(

anyway... do you know how to solve that other problem?
 
Ramzess,

Not sure I understand, but:

Format([YourDate], "dd-mmm-yyyy") & [OtherField]

Wayne
 
WayneRyan, Thanks! That explains a lot and solves my problem. Really - thank you!
 

Users who are viewing this thread

Back
Top Bottom