hi all,
I have a form that I use to search for records by various fields in my main table.
One of these search options is for records between certain dates.
On the Frmdatabasesearch form I have two text boxes - Txtstartdate and Txtfinishdate, and a Search Now command button.
The user enters the start date and finish dates for the required period of time, then clicks on the Search now button. This opens the Frmsearchbydaterange form, which is populated by a query.
Here's the problem - running the query by itself works fine, but if I try to run it through the frmdatabasesearch form, I get the following error
"Run-Time error '2501'
The OpenForm action was cancelled.
You used a method of the DoCmd object to carry out an action in visual basic, but then clicked Cancel in a dialog box".
The critera in my query is -
Between [forms]![frmdatabasesearch]![txtstartdate] And [forms]![frmdatabasesearch]![txtfinishdate]
Any one got any ideas whats wrong with this?
I can open the frmsearchbydaterange form by itself, and enter the dates in the pop-up input boxes, and it works fine, so I'm guessing that the problem might be in the opening of one form from the other. Maybe this thread should be in a different forum.
If I don't enter any dates, the form opens, but with no data (obviously).
any help is greatly appreciated.
Thanks in advance,
Kev.
I have a form that I use to search for records by various fields in my main table.
One of these search options is for records between certain dates.
On the Frmdatabasesearch form I have two text boxes - Txtstartdate and Txtfinishdate, and a Search Now command button.
The user enters the start date and finish dates for the required period of time, then clicks on the Search now button. This opens the Frmsearchbydaterange form, which is populated by a query.
Here's the problem - running the query by itself works fine, but if I try to run it through the frmdatabasesearch form, I get the following error
"Run-Time error '2501'
The OpenForm action was cancelled.
You used a method of the DoCmd object to carry out an action in visual basic, but then clicked Cancel in a dialog box".
The critera in my query is -
Between [forms]![frmdatabasesearch]![txtstartdate] And [forms]![frmdatabasesearch]![txtfinishdate]
Any one got any ideas whats wrong with this?
I can open the frmsearchbydaterange form by itself, and enter the dates in the pop-up input boxes, and it works fine, so I'm guessing that the problem might be in the opening of one form from the other. Maybe this thread should be in a different forum.
If I don't enter any dates, the form opens, but with no data (obviously).
any help is greatly appreciated.
Thanks in advance,
Kev.