G
Guest
That probably doesn't describe things well, but here's what I need:
I have a combo box that, currently, uses a select query added to the
rowsource of the combo box to populate it. The query produces two rows, the
bound one is a contactID, and the unbound, displayed one is the contact name.
Some names have just a first and last name, and that's what my current query
returns. What I want to do is be able to return the full names, which means
I need to, I think, check each name field (first, middle, last) in order, and
if there is an entry for that field (len[field]>0), then I need to add it to
the variable that's returned as the name to be displayed in the control box
in question.
I've seen code that does this, but I can't find it now. It utilizes IF/Then
statements and, I think, a variable ROUGHLY like this:
Dim myvar as String
If len(firstname)>0 Then
myvar = myvar " & "firstname"
Same for middle and last names except myvar = myvar & " " & "[lastname]" or
something like that to add a space in the returned string.
I hope the above will be good enough so someone can understand what I need
the code to do, but I'm sure it's syntax is error-filled. I also don't know
exactly how to go about using the code....I assume it would NOT be able to be
typed in the row source of the control as my current select query is, but
that it has to go either in the object module or in some seperate module or
something.
I'm sure others have seen the code I"m talking about, and just finding that
would be half the battle.
Thanks,
CW
I have a combo box that, currently, uses a select query added to the
rowsource of the combo box to populate it. The query produces two rows, the
bound one is a contactID, and the unbound, displayed one is the contact name.
Some names have just a first and last name, and that's what my current query
returns. What I want to do is be able to return the full names, which means
I need to, I think, check each name field (first, middle, last) in order, and
if there is an entry for that field (len[field]>0), then I need to add it to
the variable that's returned as the name to be displayed in the control box
in question.
I've seen code that does this, but I can't find it now. It utilizes IF/Then
statements and, I think, a variable ROUGHLY like this:
Dim myvar as String
If len(firstname)>0 Then
myvar = myvar " & "firstname"
Same for middle and last names except myvar = myvar & " " & "[lastname]" or
something like that to add a space in the returned string.
I hope the above will be good enough so someone can understand what I need
the code to do, but I'm sure it's syntax is error-filled. I also don't know
exactly how to go about using the code....I assume it would NOT be able to be
typed in the row source of the control as my current select query is, but
that it has to go either in the object module or in some seperate module or
something.
I'm sure others have seen the code I"m talking about, and just finding that
would be half the battle.
Thanks,
CW