Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenating field values in an expression 3

Status
Not open for further replies.

thirty4d

MIS
Feb 1, 2001
61
US
Hi

I have this expression in one of my textbox in a form:

="CA" & [lbxCuttingTools].[Column](0)
& IIf(IsNull(Nz([txtInsertID])),"","-"
& [lbxInserts].Column](0))
& IIf(IsNull(Nz([txtAdapterID])),"","-"
& [lstAdapterResult].[Column](0))


When testing my form with a record that I know does not contain a value, in this case, txtInsertID, the output was not what I wanted. For example I was getting one too many dashes.

This is what i have as a result: CA934--276

Am I missing something in my expression?
 
Try checking for the presence of a " " (space). The field may contain a space and not a null....
 
Looks like you don't need the NZ function... Look it up in help, your missing a parameter if you need it.
 
thirty4d,

I always thought the Nz function is used to prevent you from getting a null value.

It seems you could never have
Code:
IsNull(Nz(anyVal)
return True.


Try the following.
Code:
="CA" & [lbxCuttingTools].[Column](0) 
& IIf(Nz([txtInsertID]) = "","","-" 
& [lbxInserts].Column](0)) 
& IIf(Nz([txtAdapterID]) = "","","-" 
& [lstAdapterResult].[Column](0))


HTH


John


 

Thanks to all of you that made a suggestion!

I got rid of the problem by looking harder. Carelessness on my part. I have the receiving textbox format property as a number where the control sources were all text!


Sorry guys :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top