Access 2002 Data Validation Rules/Text Help.

D

Dermot Hayes

Using Access 2002 I have made up a table for fields:- Job
Number, Model Number and Serial Number. I have created a
Parameter Query for all three fields to prompt for "Enter
Job Number". I have created a form based on the parameter
query. On the Form I have a Command Button which when
clicked runs a macro to trigger the Parameter Query, which
I have labelled as Next Job.
The table will always have Job Numbers and Model Numbers
entered into it.
My Question: - How do I write a validation rule so that
when an Incorrect Job Number or rubbish is Entered into
the Parameter query, instead of a valid Job Number, a
message box is displayed saying "Please Enter A Valid Job
Number"
If I were to leave it as it is, some one may not notice
they have called up a blank record and enter a serial
number, generating and unwanted record into the table.
I am not sure if it is a validation rule I would use for
this....Any help and advise would be appreciated.
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You cannot validate the value entered in a query's parameter prompt.
It is better to create a form that will provide criteria for the
query. The query can use the form's control's reference as the
parameter. E.g.:

PARAMETERS Forms!frmCriteria!txtJobNumber Long:
SELECT ...
FROM ...
WHERE JobNumber = Forms!frmCriteria!txtJobNumber

The form has to be open for the query to work.

This methodology has been described many times in this & other Access
news groups. It is also described in the Access Help article
Parameter Queries: Create a parameter query.


MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQE0Gt4echKqOuFEgEQIF0ACgpJDvm8o0XVD2iiyQN2ootMS6EesAoIY7
anVaoweF08j7WPm87Iey/SKX
=VjPG
-----END PGP SIGNATURE-----


Dermot Hayes wrote:
My Question: - How do I write a validation rule so that
when an Incorrect Job Number or rubbish is Entered into
the Parameter query, instead of a valid Job Number, a
message box is displayed saying "Please Enter A Valid Job
Number"
< SNIP >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top