Validating a field

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

Guest

Hello, i want to make a validation rule directly build in the table (the validation is also going to be in the program, but i want more security just in case)

I have 3 fields Name (as text), StartTime (as Integer), EndTime(as Integer

and i want to place a validation rule where EndTime>= Startim
but in the Design view, when i input in the (Validation Rule field) >=StartTim
and input data into the table but it still allows me to put smaller values in EndTime

Please help me out, thanks in advance.
 
Hello, i want to make a validation rule directly build in the table (the validation is also going to be in the program, but i want more security just in case).

I have 3 fields Name (as text), StartTime (as Integer), EndTime(as Integer)

and i want to place a validation rule where EndTime>= Startime
but in the Design view, when i input in the (Validation Rule field) >=StartTime
and input data into the table but it still allows me to put smaller values in EndTime.

Please help me out, thanks in advance.

You cannot refer to another field in a *field* validation rule - I
suspect that it's comparing the ENdTime to the *text string*
"StartTime".

Instead, view the Table's properties and set the Table Validation rule
to

[EndTime] > [StartTime]
 
To compare values across fields, use the Validation Rule of the table, not
that of the fields.

With the table open in design view, choose Propeties from the Toolbar.
In the Properties box, enter the Validation Rule for the table:

([StartTime] Is Null) OR ([EndTime] Is Null) OR ([StartTime] <= [EndTime])


(BTW: don't use "Name" as a field name. Most things in Access have a Name
property, so it is likely to misunderstand a reference like:
Forms.MyForm.Name
as the Name of the form instead of the contents of your field. Same for
Date, Section, and other reserved words/built-in properties.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

J.R.A.V. said:
Hello, i want to make a validation rule directly build in the table (the
validation is also going to be in the program, but i want more security just
in case).
 
Back
Top