concatenating ..if..then else?? or something like that

ppoindexter

Registered User.
Local time
Today, 15:50
Joined
Dec 28, 2000
Messages
134
is there a way to concatenate 4 text fields, and leave off the text between the & " " & if the next field is null??

EXAMPLE
Resource: [fldreference] & " " & [fld_free_text] & " " & [fld_txt_book_lesson] & " pp. " & [fldpages]

gives me: "The Math Book of Addiion", "Adding 2 and 2". pp.

as this reference has no page numbers i get the pp. and nothing else....as there is nothing else

i would like it to read: "The Math Book of Addiion", "Adding 2 and 2". WHEN NO PAGE NUMBERS EXIST

thanks
 
[fldreference] & " " & [fld_free_text] & " " & [fld_txt_book_lesson] & Iif(IsNull([fldpages]," "," pp. " & [fldpages]))
 
Rich

Rich said:
[fldreference] & " " & [fld_free_text] & " " & [fld_txt_book_lesson] & Iif(IsNull([fldpages]," "," pp. " & [fldpages]))

i tried using the above syntax but i get an error
stating the function has the wrong number of arguments...
 
ppoindexter,

Code:
Resourdce: [fldreference] & " " & _
                   [fld_free_text] & " " & _
                   [fld_txt_book_lesson] & _
                   Iif(IsNull([fldpages])," "," pp. " & [fldpages])

Note: I splict it into multiple lines for readability.

Wayne
 
ok
i must be missing something here
i am still getting the same error "wrong number of arguments"

maybe i am putting this code in the wrong place
its in a field row of the query
 
In the code you have in your last post you are missing a closing ")".

Your post:
[fldreference] & " " & [fld_free_text] & " " & [fld_txt_book_lesson] & Iif(IsNull([fldpages]," "," pp. " & [fldpages]))

How it should look:

[fldreference] & " " & [fld_free_text] & " " & [fld_txt_book_lesson] & Iif(IsNull([fldpages])," "," pp. " & [fldpages])

Try that - Notice I moved the ")" from the end to after the [fldpages] field reference part of the IsNull function.

GumbyD
 

Users who are viewing this thread

Back
Top Bottom