Add error handling to parameter query?

T

TKM

I have a between date type parameter query. How would I add error handling to
a parameter. Example: If the user puts in the wrong date. I want it to return
a msg stating...Invalid date entered.

how or where would I begin.

Thanks in advance
 
V

Van T. Dinh

Generally, Query processing does not have any way for you to customise the
error-handling AFAIK.

A work-around is to create a Form frmParameter to allow the user to enter
param values with a CommandButton to open / execute the Query which uses the
Form's Controls as the Parameters. In the CommandButton_Click Event, you
can validate the user's input. If the input is invalid, you can provide a
msg to the user. If the input is valid, you can then open / execute the
Query and Access will replace the Parameters with the values in the
Controls.
 
T

TKM

Thank you that is not what I was looking for but it is a GREAT work around.
Thanks again
 
T

TKM

Van,

In reguards to this reponse you left a while back and I thank you for your
help. Do you know of a way I can add a parameter that would fire off a start
date and a End Date from the same field in my ain query? The only catch I am
using the same query nested within two other queries and it ask for the
parameter everytime I run the main query. I have code that fires off the
query in turn ask for the two seprate Date parameters (3 times) then sends
the query to Excel. This is caused because it is nested. I have tried various
ways to elimanate this but come up with nothing. Any Ideas? Thanks again for
your help!
 
V

Van T. Dinh

I normally avoid this by using a frmParameter as detailed in my first post
in this thread. This way, I simply use the references to the Controls on
the Form as many time as I need ...
 
Top