Set Error Message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that searches for a specific month and returns the data for
that month. If I type in the month wrong, it takes me to a blank datasheet. I
want to make an error message, something like "This is not a valid month",
say if the month is mispelled or something, they would get this error. Is
that possible? Right now my query field is "Expr1: Format([Date
Ordered],"mmmm")" and my criteria is "[Enter Full Month Name:]". Please Help.
 
There is no real control over doing that using a simple parameter prompt.

You will need a form and a control to get the value and will have to call
the query from the form.
Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm

A brief quote from an John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria) with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select the
table for the selections, and be
sure that the bound field of the combo is the value you want to use as a
criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Keywords: Parameter Queries
 
okay, thanks.

John Spencer said:
There is no real control over doing that using a simple parameter prompt.

You will need a form and a control to get the value and will have to call
the query from the form.
Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm

A brief quote from an John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria) with
a Combo Box control (cboCrit) on it. Use the combo box wizard to select the
table for the selections, and be
sure that the bound field of the combo is the value you want to use as a
criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that form
or report, the user can enter the criterion and view the results in one
simple operation!

Quoting John Vinson

Keywords: Parameter Queries

Natalie said:
I have a query that searches for a specific month and returns the data for
that month. If I type in the month wrong, it takes me to a blank
datasheet. I
want to make an error message, something like "This is not a valid month",
say if the month is mispelled or something, they would get this error. Is
that possible? Right now my query field is "Expr1: Format([Date
Ordered],"mmmm")" and my criteria is "[Enter Full Month Name:]". Please
Help.
 
Back
Top