Row Source for Combo Box

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
 
J

Jim Allensworth

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
 
J

Jim Allensworth

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
 
F

fred

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
.
 
F

fredg

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top