syntax help again

S

smk23

Need help on the following syntax:

Me.NameDisplay.ControlSource = "= 'S Node Data" & vbCrLf & vbCrLf & _
mlngClientID & " ' ' " & Me.LastName & " ', ' " & _
Me.FirstName & " ' ' " & Me.MiddleName & _
IIf(IsNull(Me.bd_p_NickName), "", " (" & Me.bd_p_NickName & ")")

I'm fine until the second line quotation marks. I'm trying to put a space in
before the name... Also, the IIf statement needs help with regard to
quotation marks.
Thanks so much.
 
J

John Vinson

Need help on the following syntax:

Me.NameDisplay.ControlSource = "= 'S Node Data" & vbCrLf & vbCrLf & _
mlngClientID & " ' ' " & Me.LastName & " ', ' " & _
Me.FirstName & " ' ' " & Me.MiddleName & _
IIf(IsNull(Me.bd_p_NickName), "", " (" & Me.bd_p_NickName & ")")

I'm fine until the second line quotation marks. I'm trying to put a space in
before the name... Also, the IIf statement needs help with regard to
quotation marks.
Thanks so much.

This will set the Control Source to

= 'SNode Data

312 Vinson ', ' John ' ' W (Wysard)

as I read it. You're not putting a space before the last name; you're
putting the literal character string space, apostrophe, three spaces,
another apostrophe, and space. There's also an extra (?) apostrophe
before the word SNode with no closing quote mark, if that apostrophe
is intended as a quote character.

Please post an example of what you want the data to look like, and -
preferably - WHY you're setting the Control Source of the field to
this very odd concatenation of stuff! Wouldn't it be easier to build
up this string in a calculated field in the Query upon which this form
or report is based?

John W. Vinson[MVP]
 
S

smk23

John:
I switched this to a label which eliminated the problem and displays
correctly.
Here is what I was after:

SNode Data

312 Vinson, John W (Wysard)

This should probably be a calculated field in the query statement but I
didn't think of that. :)
But I will ask why one over the other? Is there any performance advantage to
writing this out in the query statement vs on the form itself?

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top