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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top