From: CorpTrainer570 on
I am trying to create a database in which some of the fields should be
mandatory only under certain conditions.

For example:

In my "Type of Injury" column, I want the user to be required to enter a
value in this column, only if the value in the "Type of Document" column is
"Nursing Report". Is this possible? I am only just beginning to teach
myself Access, so please bear with me. Thank you.
From: Allen Browne on
Put a validation rule on the *table* (not field.)

2nd example under the the Validation Rules for Tables section here:
http://allenbrowne.com/ValidationRule.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"CorpTrainer570" <CorpTrainer570(a)discussions.microsoft.com> wrote in message
news:6897C488-458F-4B71-940A-C2528267E360(a)microsoft.com...
> I am trying to create a database in which some of the fields should be
> mandatory only under certain conditions.
>
> For example:
>
> In my "Type of Injury" column, I want the user to be required to enter a
> value in this column, only if the value in the "Type of Document" column
> is
> "Nursing Report". Is this possible? I am only just beginning to teach
> myself Access, so please bear with me. Thank you.

From: CorpTrainer570 on
Thanks for the reply, but is there a way to create a validation rule that
would specifically look for words. for example:

in the "Type of Document" column there are three options: "nursing report",
"progress note", incident report". Depending on what type of document is
selected, certain fields should be required to filled in.

If "nursing report" than "type of injury" must be filled in.
If "progress note" than "program" must be filled in.
If "incident report" than "Description of incident" must be filled in.

"Allen Browne" wrote:

> Put a validation rule on the *table* (not field.)
>
> 2nd example under the the Validation Rules for Tables section here:
> http://allenbrowne.com/ValidationRule.html
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
>
> "CorpTrainer570" <CorpTrainer570(a)discussions.microsoft.com> wrote in message
> news:6897C488-458F-4B71-940A-C2528267E360(a)microsoft.com...
> > I am trying to create a database in which some of the fields should be
> > mandatory only under certain conditions.
> >
> > For example:
> >
> > In my "Type of Injury" column, I want the user to be required to enter a
> > value in this column, only if the value in the "Type of Document" column
> > is
> > "Nursing Report". Is this possible? I am only just beginning to teach
> > myself Access, so please bear with me. Thank you.
>
> .
>
From: John W. Vinson on
On Wed, 17 Feb 2010 08:26:03 -0800, CorpTrainer570
<CorpTrainer570(a)discussions.microsoft.com> wrote:

>Thanks for the reply, but is there a way to create a validation rule that
>would specifically look for words. for example:
>
>in the "Type of Document" column there are three options: "nursing report",
>"progress note", incident report". Depending on what type of document is
>selected, certain fields should be required to filled in.
>
>If "nursing report" than "type of injury" must be filled in.
>If "progress note" than "program" must be filled in.
>If "incident report" than "Description of incident" must be filled in.

A validation rule would be a really awkward way to do this - the BeforeUpdate
event of a Form would be much better and more user friendly. That said, a
table validation rule (*NOT* a field validation rule) might be:

([Type Of Document] = "Nursing Report" AND [Type Of Injury] IS NOT NULL)
OR
([Type Of Document] = "Progress Note" AND [Program] IS NOT NULL)
OR
([Type Of Document] = "Incident Report" AND [Description Of Incident] IS NOT
NULL)

The validation text would be snarky, because it will be displayed identically
regardless of which case occurred - you can customize the message in the VBA
code of the BeforeUpdate event, but you can't here.
--

John W. Vinson [MVP]
 | 
Pages: 1
Prev: Web Database
Next: Extra relationship