Click to See Complete Forum and Search --> : DB and Combo Box
brianh
Nov 16th, 2000, 06:24 PM
OK here is my question:
If you wanted to fill the contents of two different fields into one combo box how would you do it? Example:
One field called email, the other one called email_address.
Combo box called cboemail
Could you place the email field next to the email_address in the combo box. So in other words the email field would match the name to the actual persons email address.
AdrianH
Nov 17th, 2000, 06:32 AM
Is this what you are after? Using an unbound combo box control.
Dim rcsTest as recordset
Dim SQLStatement as string
SQLStatement = "Select [email], [email_address] from [Table]....."
Set rcsTest = YourDB.OpenRecordset(SQLStatement)
with rcsTest
if (not .BOF) and (not .EOF) then .MoveFirst
Do While Not .EOF
cboemail.additem ![email] & chr(9) & [email_address]
.movenext
loop
.close
end with
Or have I missed the point?
Adrian.
brianh
Nov 17th, 2000, 09:05 AM
That should work, I changed the names of the fields to the actual ones that I use but I get external name not defined, compile error. It is saying that it does not know what I am trying to refer to. Any suggestions?
brianh
Nov 17th, 2000, 09:42 AM
It breask on:
cboemail.AddItem ![Name] & Chr(9) & [email_addrs].
paulw
Nov 17th, 2000, 10:30 AM
You have missed out ! in fornt of [email_adrs]
Cheers,
P.
brianh
Nov 17th, 2000, 10:50 AM
Thats not or I am not getting it....
brianh
Nov 17th, 2000, 12:22 PM
Any more suggestions?
brianh
Nov 17th, 2000, 12:51 PM
OK I kind of got it but how do I have it fill on the same line as the address.
Example it is coming up like this
hartlbb@dshs.wa.gov
Brian Hratline
I want it to look like
hartlbb@dshs.wa.gov - Brian Hartline
AdrianH
Nov 18th, 2000, 07:34 AM
How about cboemail.additem ![Name] & " - " & ![email addrs]
Adrian.
LG
Nov 18th, 2000, 05:25 PM
You can use Space function:
cboemail.AddItem ![Name] & Space(5) & ![email_addrs]
or
cboemail.AddItem ![Name] & " " & ![email_addrs]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.