Question : Combo box row source - modify query to work in VBA

I need this query to work in VBA.  I copied it straight from the query wizard and want to assign it to the rowsource for my combo box:

here is what i have:

Me.cboDef.RowSource = "SELECT [CI_Definition] & " " & [ci_definitions].[subcode] AS Def, [CI_Definitions].[CI_Desc] FROM CI_Definitions, policyAdminCI_Codes WHERE ((([policyAdminCI_Codes].[policyCI_ID])=[Forms]![ClaimantCI]![txtCI_polAdmin_ID])) GROUP BY [CI_Definition] & " " & [ci_definitions].[subcode], [CI_Definitions].[SubCode], [CI_Definitions].[CI_Desc]"

I need it to work in VBA.

Answer : Combo box row source - modify query to work in VBA

Try this,

Me.cboDef.RowSource = "SELECT CI_Definition, ci_definitions.subcode AS Def, " & _ "CI_Definitions.CI_Desc FROM CI_Definitions, policyAdminCI_Codes " & _
"WHERE policyAdminCI_Codes.policyCI_ID = Forms!ClaimantCI!txtCI_polAdmin_ID " & _
"GROUP BY CI_Definition, ci_definitions.subcode, CI_Definitions.SubCode, CI_Definitions.CI_Desc"

Random Solutions  
 
programming4us programming4us