Re: Custom Validation Rules
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 01/19/05
- Next message: Lynn Trapp: "Re: Multiple Users from differant sites accessing the same Databas"
- Previous message: Jeff Boyce: "Re: Custom Validation Rules"
- In reply to: TonyB: "Re: Custom Validation Rules"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 19 Jan 2005 21:32:51 +0800
Yes, you would not normally modify the ValidationRule property of a table
field once the database is in use, though you might need to create or clear
a rule as part of a version update on a database that is already installed.
If you have a Validation Rule in place in the field of the table or in the
table itself, you don't need any code. If the validation is too complex to
use the rule in the table, or if you want to give the user the chance to
override it and make the entry anyway, then it makes sense to use the form
events for this. Use the BeforeUpdate event of the control to validate one
field (e.g. to make sure it is in range), or the BeforeUpdate event of the
form to validate the record (e.g. to compare values between fields, or to
ensure that an entry was made in a field.)
Again, once you have this code in place, you would not normally need to
change the code, unless you need it for a version update.
Hope that's useful
-- 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. "TonyB" <tonyb@kerrisway.freeserve.co.uk> wrote in message news:uVRMzPi$EHA.3336@TK2MSFTNGP11.phx.gbl... > Hi Allen, > Thanks for the reply. I didn't explain myself clearly. I was looking for a > general method of attaching some vba code to the field in a record so that > when a new record is entered that this code can be run to check the data > for > that field is OK Basically I am trying to customize the validation rules > you > get in table design view. > Since I posted I have been searching for info about this, and I think I > have > concluded this is probably not possible in a table, and that this should > be > done in the form used to enter the data into the table, rather than in the > table. Would you agree ? > > Thanks > Tony > > > "Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message > news:eipMJpg$EHA.2032@tk2msftngp13.phx.gbl... >> To programatically set the Validation Rule property for a field named > Email >> in a table named Table1, try something like this: >> >> Currentdb.TableDefs("Table1").Fields("Fee").ValidationRule = _ >> "Is Null Or ((Like ""*?@?*.?*"") And (Not Like ""*[ ,;]*""))"
- Next message: Lynn Trapp: "Re: Multiple Users from differant sites accessing the same Databas"
- Previous message: Jeff Boyce: "Re: Custom Validation Rules"
- In reply to: TonyB: "Re: Custom Validation Rules"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|