Rabu, 29 Juni 2011

RE: [MS_AccessPros] Validation Rule for Date

 

Marwa-

What are the other date fields? If there are lots of them, maybe they should be
in another table.

An alternative is to NOT do the validation in the table but to use the Before
Update event of the form you provide to enter the data. You can do all the
validation you want there and Cancel the edit if something fails.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Marwa Abo Amra
Sent: Wednesday, June 29, 2011 3:07 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Validation Rule for Date

John, what if I need to do this for some other date fields. I have more than 15
fields of date that need to be related to each other in the same manner. Should
I write up all validation rules in the table properties, or should I write each
one separately in each field's properties? Please advice.

Thank you for your great help!

Marwa

--- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@...> wrote:
>
> Marwa-
>
> It must be a Validation Rule on the table, not on a field. Did you open the
> table's Properties window?
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of m.statalex
> Sent: Wednesday, June 29, 2011 2:32 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: Re: [MS_AccessPros] Validation Rule for Date
>
> John, Thank you!
>
> I still have a problem, when I entered that validation rule I got the message:
> Invalid SQL syntax - cannot use multiple columns in a column-level CHECK
> constraint.
>
> I don't know what this means. Can you help??
>
> Thanks once again!
>
> Marwa
>
>
> --- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@> wrote:
> >
> > Marwa-
> >
> > You can do it in the table directly. Open the table in Design view and then
> > open the Properties window. In the Validation Rule, enter:
> >
> > =IsNull([Date Of Death]) Or (([Date Of Death] > [Date of Birth]) And ([Date
Of
> > Death] < Date()))
> >
> > In Validation Text, put a meaningful message such as:
> >
> > Date of Death must be later than Date of Birth and earlier than today.
> >
> > John Viescas, author
> > Microsoft Office Access 2010 Inside Out
> > Microsoft Office Access 2007 Inside Out
> > Building Microsoft Access Applications
> > Microsoft Office Access 2003 Inside Out
> > SQL Queries for Mere Mortals
> > http://www.viescas.com/
> > (Paris, France)
> >
> >
> > -----Original Message-----
> > From: MS_Access_Professionals@yahoogroups.com
> > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Marwa Abo Amra
> > Sent: Wednesday, June 29, 2011 1:23 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > Subject: [MS_AccessPros] Validation Rule for Date
> >
> > Hi All,
> >
> > I need help in writing a validation rule for entering a date in a field. I
> have
> > a form that has two dates to be entered: Date of Birth and Date of Death. I
> > would like to write a validation rule in the Date of Death control so that
> users
> > can only enter values greater than date of birth and before today. I am not
> sure
> > what to write in the validation rule of that field in the table that I
created
> > the form from so the form cannot accept any values of date that I mentioned.
> >
> > Waiting for your assistance, pals!
> >
> > Thank you.
> >
> > Marwa
> >
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar