Combobox RowSource with Value List and Concatenation

  • Thread starter robert demo via AccessMonster.com
  • Start date
R

robert demo via AccessMonster.com

I'm trying to set the RowSource property of a combobox for a value list. I
want to concatenate variables
into the statement. The combobox will have two columns, the second of which
will be hidden to the user.

So:

Code:
------------------------------------------------------------------------------
--

Me.Sort_Combobox.RowSourceType = "Value List"
Me.Sort_Combobox.RowSource = "'Site/Building';'SITE ASC, BUILDING_NO ASC';
' & Me.Year1 & Usage ';'YEAR1_USAGE';
' & Me.Year2 & Usage ';YEAR_2_USAGE';
'Percent Difference';'PERCENT_DIFFERENCE'"
Me.Sort_Combobox.Requery
------------------------------------------------------------------------------
--


Year1 and Year2 are comboboxes on the form that the user can select a year
from. I want the sort combobox to display those actual years (2001, 2002, etc.
). Currently the "&" shows up in the combobox, so clearly the statement isn't
correct.

Thanks.
 
G

Guest

' & Me.Year1 & Usage ';'YEAR1_USAGE';
'" & Me.Year1 & Usage & "';'YEAR1_USAGE';

Note the extra quote marks to take the string concatenation outside the
string constant.

(david)
 
Top