S
sword856
Hello all, I am having something weird happen to me when I try to run
a query/report from a form. The form has:
Combo box - cboPickTask
Text Box - txtQCriteria
CmdButton - cbutRunQuery
cmdButton - cbutGetRep
It is an unbound form and is simply used as the selector for the query
criteria. User selects task from dropdown menu, query returns all
personnel who have not completed the task. Personnel are either
supervisory or non-supervisory. In the combo RowSource is a column
beside the task name that is either "All", "Supervisory" or "Non-
Supervisory". I am trying to get the query to show only those who
have to complete the task and haven't, and exclude those who haven't
taken the class but don't have to. Right now, I can get it to work
for supervisory and non-supervisory, but not for all. Here is my code
for the combo after update:
Private Sub cboPickTask_AfterUpdate()
If cboPickTask.Column(1) = "Non-Supervisory" Then
txtQCriteria.Value = "0"
ElseIf cboPickTask.Column(1) = "Supervisory" Then
txtQCriteria.Value = "-1"
Else
txtQCriteria.Value = "0 Or -1"
End If
End Sub
If I select a task that is "All" or try to use "yes" or "no" instead
of "-1" and "0", then I get the error "You Cancelled the previous
operation" when I try to run the query, and the error that the
expression is too complex if I try to run the report. In both cases
the only option is to click "OK" and do nothing.
Note: I went into the query and manually typed in "0 Or -1" for the
SupervisoryStatus criteria and it worked as I wanted it to.
If anyone could explain why this isn't working, I would be very
grateful.
TIA,
George
a query/report from a form. The form has:
Combo box - cboPickTask
Text Box - txtQCriteria
CmdButton - cbutRunQuery
cmdButton - cbutGetRep
It is an unbound form and is simply used as the selector for the query
criteria. User selects task from dropdown menu, query returns all
personnel who have not completed the task. Personnel are either
supervisory or non-supervisory. In the combo RowSource is a column
beside the task name that is either "All", "Supervisory" or "Non-
Supervisory". I am trying to get the query to show only those who
have to complete the task and haven't, and exclude those who haven't
taken the class but don't have to. Right now, I can get it to work
for supervisory and non-supervisory, but not for all. Here is my code
for the combo after update:
Private Sub cboPickTask_AfterUpdate()
If cboPickTask.Column(1) = "Non-Supervisory" Then
txtQCriteria.Value = "0"
ElseIf cboPickTask.Column(1) = "Supervisory" Then
txtQCriteria.Value = "-1"
Else
txtQCriteria.Value = "0 Or -1"
End If
End Sub
If I select a task that is "All" or try to use "yes" or "no" instead
of "-1" and "0", then I get the error "You Cancelled the previous
operation" when I try to run the query, and the error that the
expression is too complex if I try to run the report. In both cases
the only option is to click "OK" and do nothing.
Note: I went into the query and manually typed in "0 Or -1" for the
SupervisoryStatus criteria and it worked as I wanted it to.
If anyone could explain why this isn't working, I would be very
grateful.
TIA,
George