Results 1 to 4 of 4
  1. #1
    kreelix is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2015
    Posts
    3

    Need Help Setting a Maximum Number

    Hello all. New to the forum here! I am taking my first Access course and I am having a little trouble with my tables. One table I have is for the number of hours an employee has worked. I am suppose to create some sort of rule that will not let the user enter a number greater than 40 in the field and if they try they will be given an error stating "The number of hours must not exceed 40."



    Another part of this same problem which I know will tie to my first issue; I need to make it so that the date of hire for employees is either today's date or earlier. If an invalid date is entered, an error is displayed.

    I was wondering if anyone could help with this. I am pretty hung up on it.

    Edit: Wait...may have figured it out. Validation rules?! Working on it now....

    Thank you!

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428
    in the control properties you will see under the data tab two properties - validation rule and validation text

    in the validation rule put

    Code:
    >0 and <=40
    (I presume you don't want the user to be able to enter a negative number

    in the validation text put
    Code:
    The number of hours must not exceed 40

  3. #3
    kreelix is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2015
    Posts
    3
    Thank you. I just got actually right before you posted.

    Now though, I am still stuck on the date part of things...

    Would this work?

    Code:
    <Int(Now())

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Try
    Code:
    <=Date()

    FYI, I know this is an assignment, but I never do validation in tables. I do the validation in queries, forms or code because I have better control over the validation.

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

Similar Threads

  1. Replies: 5
    Last Post: 07-14-2015, 08:53 AM
  2. Replies: 1
    Last Post: 02-05-2015, 08:12 AM
  3. Minimum and Maximum Number
    By mohanmoni in forum Queries
    Replies: 3
    Last Post: 02-04-2015, 01:55 PM
  4. Maximum number of fields in a Form
    By Bhat59 in forum Forms
    Replies: 2
    Last Post: 10-30-2011, 06:45 AM
  5. Replies: 2
    Last Post: 06-22-2010, 07:09 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