Combo Rowsource: WHERE one criteria works but two give no results.

G

Guest

I'm trying to determine the rowsource for a combo box depending on what group
(stored in glGroup) the user belongs to. So on the _Current even of the main
form, I'm using strSource as the source for the combo box. Now, if the
usergroup is 1, the combo box works fine. But if the usergroup is 2, then the
combo box has no records (and there is data matching the fields I'm looking
for in the table). Anything jump out at anyone?

If glGroup = "1" Then strSource = "SELECT tblChartsAvailable.ChartName,
tblChartsAvailable.EventChartID, tblChartsAvailable.ChartEvent,
tblChartsAvailable.ChartOrganization FROM tblChartsAvailable WHERE
(((tblChartsAvailable.ChartEvent)=[forms]![frmChartsByEvent]![Event]))"

If glGroup = "2" Then strSource = "SELECT tblChartsAvailable.ChartName,
tblChartsAvailable.EventChartID, tblChartsAvailable.ChartEvent,
tblChartsAvailable.ChartOrganization FROM tblChartsAvailable WHERE
(((tblChartsAvailable.ChartEvent)=[forms]![frmChartsByEvent]![Event])) AND
((tblChartsAvailable.ChartOrganization) = """ & glOrganization & """)"

Forms![frmChartsByEvent]![frmChartsByEventSub]![EventChartID].RowSource =
strSource
 
M

Marshall Barton

Ann said:
I'm trying to determine the rowsource for a combo box depending on what group
(stored in glGroup) the user belongs to. So on the _Current even of the main
form, I'm using strSource as the source for the combo box. Now, if the
usergroup is 1, the combo box works fine. But if the usergroup is 2, then the
combo box has no records (and there is data matching the fields I'm looking
for in the table). Anything jump out at anyone?

If glGroup = "1" Then strSource = "SELECT tblChartsAvailable.ChartName,
tblChartsAvailable.EventChartID, tblChartsAvailable.ChartEvent,
tblChartsAvailable.ChartOrganization FROM tblChartsAvailable WHERE
(((tblChartsAvailable.ChartEvent)=[forms]![frmChartsByEvent]![Event]))"

If glGroup = "2" Then strSource = "SELECT tblChartsAvailable.ChartName,
tblChartsAvailable.EventChartID, tblChartsAvailable.ChartEvent,
tblChartsAvailable.ChartOrganization FROM tblChartsAvailable WHERE
(((tblChartsAvailable.ChartEvent)=[forms]![frmChartsByEvent]![Event])) AND
((tblChartsAvailable.ChartOrganization) = """ & glOrganization & """)"

Forms![frmChartsByEvent]![frmChartsByEventSub]![EventChartID].RowSource =
strSource


The only things I question are if ChartOrganization really
is a Text field and what is the value of glOrganization at
the time the code executes.

I guess there could also be the usual confusion if
ChartOrganization is a lookup field.
 

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