I am building some queries using a Query By Form method.
I am building them so the user can select 1 or more unbound texbox fields in the search form (called QBF_Incident) to determine the paramters. Any field left blank shoudl be excluded from the parameters.
The query I am having issues with involves a date paramter. If the user enter in a Date field along with the other fields (or leave the other field empty) all is fine.
However, if the date field is left empty (and the other field do or do not have an entry), a error code is generated (Run-time error '2001'; You canceled the previous operation.) What should happen is if the date is empty, return the records for any date.
The acutal Query Date field consists of the following:
Field: ReportedDate
Table: Incident
Sort:
Show: (Is checked)
Criteria: [Forms]![QBF_Incident].[WhatDate]
The other field has the following:
Field: TypeCall
Table: Incident
Sort:
Show: (is checked)
Criteria: Like [Forms]![QBF_Incident].[WhatIncident] & "*"
The (QBF_Incident) form used has a search button using VBA to run this query and I have a reset button that resets the values to "".
I have a similar query that doens't include dates that works fine.
What do I have to have different when ignoring dates as parameters?
Thanks,
Joe
<Any field left blank shoudl be excluded from the parameters.>
...One quick technique to ignore a criteria if it is left empty:
Like "*" & [Forms]![QBF_Incident].[Wh
Does this *Have* to be done by query by form?
There are many other ways to do what you are asking...