Row Source for Combo Box

  • Thread starter Thread starter fred
  • Start date Start date
F

fred

I can't seem to be able to code the Row Source
for a combo box. Below are the lines that I've tried
and can't seem to get the right syntax.


If Me.txtHOBBIES = "INDOORS" Then
Me.cmbBOX.RowSource = "CHESS"; "TELEVISION"; "DANCING"
Else
Me.cmbBOX.RowSource = "FISHING"; "GOLF'; "HIKING"
End If
 
I can't seem to be able to code the Row Source
for a combo box. Below are the lines that I've tried
and can't seem to get the right syntax.


If Me.txtHOBBIES = "INDOORS" Then
Me.cmbBOX.RowSource = "CHESS"; "TELEVISION"; "DANCING"
Else
Me.cmbBOX.RowSource = "FISHING"; "GOLF'; "HIKING"
End If
Is the Row Source Type set to Value List?

- Jim
 
Is the Row Source Type set to Value List?
And try it like ...

If Me.txtHOBBIES = "INDOORS" Then
Me.cmbBOX.RowSource = "CHESS;TELEVISION;DANCING"
Else
Me.cmbBOX.RowSource = "FISHING;GOLF;HIKING"
End If

Those internal quotes are problematic and not needed.

- Jim
 
Jim,

Thanks a million...it works!!!!


Fred
-----Original Message-----

And try it like ...

If Me.txtHOBBIES = "INDOORS" Then
Me.cmbBOX.RowSource = "CHESS;TELEVISION;DANCING"
Else
Me.cmbBOX.RowSource = "FISHING;GOLF;HIKING"
End If

Those internal quotes are problematic and not needed.

- Jim
.
 
I can't seem to be able to code the Row Source
for a combo box. Below are the lines that I've tried
and can't seem to get the right syntax.

If Me.txtHOBBIES = "INDOORS" Then
Me.cmbBOX.RowSource = "CHESS"; "TELEVISION"; "DANCING"
Else
Me.cmbBOX.RowSource = "FISHING"; "GOLF'; "HIKING"
End If

Is the actual name of the combo box cmbBox?
Set the RowSourceType property to Value List.

Then try, in both the Form's Current event and in the txtHobbies
AfterUpdate event:

If Me.txtHOBBIES = "INDOORS" Then
Me.cmbBOX.RowSource = "CHESS, TELEVISION, DANCING"
Else
Me.cmbBOX.RowSource = "FISHING, GOLF, HIKING"
End If

If the semi-colon is your Access list separator, then use the
semi-colon instead of the comma.
 
Back
Top