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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Question 1

Status
Not open for further replies.

BeallDon

Technical User
Aug 20, 2007
46
CA
I have a form with "ClientName" and "SpouseName" fields. If I have John in "ClientName" & Mary in "SpouseName", can a Combobox be populated with the results of "ClientName", "SpouseName" and the text "Joint" only? Meaning when I pull down the combobox, the only 3 selections for the combobox would be: John, Mary & Joint.
 
You can set the RowSource to a Value List.
 
Thanks for the attempt Remou. Not quite what I had in mind.

I would like my combobox to be updated automatically if I go to the next record that has different entries in "ClientName" & "SpouseName".
 

[blue]You can update the RowSource in the Current Event.[/blue]

If you use a Union query, you will still have to Requery RowSource in the Current Event, furthermore, such a query is quite complicated:

Code:
SELECT b.Key, b.CSName, b.Inc
FROM (SELECT a.Key, a.CName AS CSName, False As Inc  
      FROM tblTable a  
      UNION SELECT a.Key, a.SName AS CSName, False As Inc 
      FROM tblTable a 
      UNION SELECT 0 As Key,"Joint" AS CSName, True As Inc 
      FROM tblTable a) AS b
WHERE (b.Key=Forms!frmForm![Key] Or b.Key=0) 
AND (b.Inc=False Or (Trim(Forms!frmForm![SName] & "")>""))
 
Private Sub Combo8_Enter()
Combo8.RowSource = Me.clientName & ";" & Me.spouseName + ";" + "Joint"
End Sub
 
MajP - That was exactly what i was looking for. Thank you VERY much.
 
So, you did want to set the RowSource to a Value List! :)
 
Yes Ramou, i did set it to value list, but that's all you suggested - i was looking for
"Private Sub Combo8_Enter()
Combo8.RowSource = Me.clientName & ";" & Me.spouseName + ";" + "Joint"
End Sub"
i just couldn't figure out the code for it.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top