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

syntax for rowsource selection

Status
Not open for further replies.

legolas75

Technical User
Mar 19, 2007
17
US
Hi,
Currently in my listbox I have a rowsource of

SELECT region_nbr, GEO_REGION FROM qry_choose_region UNION SELECT "*", "-- All Regions --" FROM MsysObjects ORDER BY GEO_REGION;

I would like to assign this rowsource programmatically to the variable strRowSource as shown below.

Me.lstbx_choose_ipa.RowSource = strRowSource

Xtra info: I want to do this because I'm going to assign the value of the rowsource depending on which option the user chooses previously on the form.

The problem is the syntax. When I paste this code I get an error saying it expected the end of the statement. I believe the quotes UNION part in which I add an item to the listbox for "All Regions" is the culprit.

Any ideas on how to assign the statement above to a variable without any errors? Thank you in advance. Mike

 
strRowSource = "SELECT region_nbr,GEO_REGION FROM qry_choose_region UNION SELECT '*','-- All Regions --' FROM MsysObjects ORDER BY 2"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top