Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Time Error 2001 in Query with Checkbox Criteria 0 Or 1

Status
Not open for further replies.

gyli84

MIS
Aug 6, 2001
67
0
0
GB
In creating a helpdesk database I have a form called "Calls" where calls received at the helpdesk are logged. Within this form there are 3 dependent combo boxes (your choice in the first restrics options in the second etc.) used to define the problem. As I wanted to be able to query calls received at the database by either just the first combo box, the first 2 or all 3 I created a form called "Problem Type Query" where I recreated the 3 combo boxes. I created 3 buttons that would enable just the first, the first 2 or all 3 combo boxes and a checkbox with the options Open Calls, Closed Calls and Any Calls which would relay the values 1, 0, 0 Or 1 to a textbox called "CompletedCriteriaNo" respectively. I have 3 separate queries created for either querying 1, the first 2 or all 3 combo boxes of records in the "Calls" table with criteria set as the options in the combo boxes on the "Problem Type Query" form as well as the "CompletedCriteriaNo" textbox as the criteria for a field in the "Calls" table called "Completed" (used to specify whether a call has been completed or not yet).
The problem is I have no trouble running queries from the form for "Closed" or "Open" calls where the "Completed" criteria is 1 for closed and 0 for open but if I choose the "Any Calls" option from the checkbox (which relays 0 Or 1 to the CompletedCriteriaNo textbox) I get a Run Time Error 2001, "You canceled the previous operation". I have other queries not run from a form where having 0 Or 1 as the criteria in the "Completed" field is fine and returns the correct call records. What might be wrong and how can I resolve it.

Thanks
 
I have tried Yes Or No and also True Or False being displayed in CompletedCriteriaNo and it still doesn't work.
 
As an experiment I tried to set the value in CompletedCriteriaNo through code rather than as it being relayed from combo_CallstoQuery. I used:

Public Function CompletedCriteriaNoSet()

If Combo_CallstoQuery = 0 Then
Me.CompletedCriteriaNo = "0"
ElseIf Combo_CallstoQuery = 1 Then
Me.CompletedCriteriaNo = "1"
Else
Me.CompletedCriteriaNo = "0 Or 1"
End If

End Function

but got a type mismatch error 13 when I selected Any Calls in the combo_CallstoQuery combo box. Might it be that it thinks these have to be integers or something? How can i fix this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top