Access 2003: Query By Forms When Date Field Is Skipped by User
Posted on 2013-01-07
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:
Show: (Is checked)
The other field has the following:
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?