Results 1 to 4 of 4
  1. #1
    tylerg11 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    200

    Validation Rule Not Working??

    I would like to require a field to be filled. Sometimes based on certain conditions, and other times in all cases. My tables are linked from a SQL Server database. I tried just using a Validation Rule in the Form Design, but it didn't give me an error if I left the field blank. Does this change have to be made at the SQL Server level?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    If it's only required under certain circumstances, I don't think you can do it with a validation rule. I'd use the before update event of the form:

    http://www.baldyweb.com/BeforeUpdate.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200
    Thanks.

    I also want a textbox on my form to always contain data (no nulls), so I added a validation rule for that control. If I fill it with data, remove, the data, and leave the field, I get an error. But if I just fill out the other fields, and leave the form, I get no error! Is this how the validation rule should be working?

    I am working with linked tables through SQL Server, and I was hoping to be able to control the data entry with this form.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    If it should always have a value, for a SQL Server field you'd uncheck the Allow Nulls in design view (in an Access table you'd set Required = Yes).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. IIf in Validation Rule
    By Bugsy in forum Access
    Replies: 6
    Last Post: 11-21-2011, 11:33 AM
  2. Validation Rule
    By Darkladymelz in forum Reports
    Replies: 2
    Last Post: 09-15-2011, 07:43 AM
  3. Validation Rule
    By rbiggs in forum Forms
    Replies: 4
    Last Post: 08-23-2011, 05:24 PM
  4. Help with validation rule
    By Desstro in forum Programming
    Replies: 5
    Last Post: 02-27-2011, 08:05 PM
  5. Validation Rule
    By smitstev in forum Access
    Replies: 5
    Last Post: 06-30-2009, 09:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums