Daily Access Tips

Answering your common Microsoft Access questions…
  • rss
  • Home
  • About
  • Contact
  • Newsletter
  • Video Tutorials
  • Help Request Form

Microsoft Access Validation Of Data Using One Line Of Code

July 7, 2009 | 11:08 pm

If you’re new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Data validation checks that data are valid, sensible, and reasonable before they are processed. Microsoft Access validation can involve a time consuming choir if one had to do it for each control or ‘access field’, on each of your Access forms. Several have authored various approaches to automate Access validation for you. No single approach will work for all situations. Your form might allow a user to move off the record before Microsoft Access validation code is triggered. If you try to prevent the user from doing so, you will need to create additional design changes and add more complexity to your form.

I chose to take a conservative approach to Access validation, which works for most situations, but with a few more lines of code, will even prevent the user from leaving an unvalidated record no mater where he mouses to.

The user is notified if a form control failed validation, told why it failed, the control is highlighted briefly, and cursor focus is moved back to the failing control. Oh yes, it doesn’t try to validate form controls that come later, in the tab order, than where the user currently is. A single line of programming code is used on the OnOpen event of your form for this Microsoft Access validation of form data. The user can be prevented from navigating off the form record, adding a new record, or closing the form if validation fails, this requires an additional line of code on the appropriate form close, add new record and navigation buttons.

An Access developer just needs to enter a few characters into the ‘TAG’ property of a form’s control. The ‘TAG’ control property stores extra information about a control. The videos below will show you how to find this property in the ‘Property Sheet’ of the control you want to validate and will demonstrate the Access validation of a form using the code found from a link at the end of this article which moves you into the article containing the full programming code. There is no programming involved unless you wish to expand on the supplied code’s functionality.

Access Form Data Validation Demonstration Video:


from youtube

http://www.youtube.com/watch?v=otCMjARPiJY

You may get your example demostration file containing all code for Access 97, 2000, 2002, 2003, 2007 – Get File #51

This is where you will find all the Microsoft Access validation code in next article:

http://dailyaccesstips.com/code-for-microsoft-access-validation-of-data/

How to locate the Access Form Control ‘Tag’ Property for Access 97, 2000, 2002XP, 2003 video:

from youtube
http://www.youtube.com/watch?v=16HVabt2gM4


How to locate the Access Form Control ‘Tag’ Property for 2007 video:


from youtube
http://www.youtube.com/watch?v=hViGDmDU3P4



Bookmark and Share

Categories
Access Custom Functions, Access Forms, Programming Code
Comments rss
Comments rss
Trackback
Trackback

« Code For Microsoft Access Validation Of Data Automating Microsoft Access Email Alerts »

6 Responses to “Microsoft Access Validation Of Data Using One Line Of Code”

« Older Comments
  1. ricardo says:
    July 8, 2010 at 12:26 pm

    i love this very timely on my small project the use of the tags wow

« Older Comments

Leave a Reply

Click here to cancel reply.

Categories

  • Access Custom Functions
  • Access Forms
  • Access Queries
  • Access Tables
  • Miscellaneous
  • Programming Code

Recent Posts

  • Access MVP Recognition
  • Microsoft Access 2010 Release News
  • Microsoft Access Security All Versions
  • Not For Null

Twitter Money On Autopilot

Get Twitter Followers Fast & Easy! 100% FREE Plus $1000's in free bonuses!

Bob Heifler

  • About
  • Contact
  • Newsletter
  • Video Tutorials

Access Resources

  • Microsoft Access Demonstration Files
  • Move data from Access to Excel
  • MyAccessProgram.com
  • Services Offered
  • Tips and Best Practices
  • Video Tutorials

Free Twitter Autopilot!

Get Twitter Followers Fast & Easy! 100% FREE Plus $1000's in free bonuses!

more help…

Microsoft Access Help

Bookmark and Share
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox