Results 1 to 4 of 4
  1. #1
    Long Tom Coffin is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    10

    Using Validation rules to restrict certain types of data entry.

    Using the (wonderful!) help I have recieved here, I've created a very good database for use in multiple departments here at office. Le Boss has declared herself pleased, but there is one more thing she requires.

    There are 3 tables I am dealing with, each connected with pk's an fk's to each other. The first table is for cash Allotments we get from the government. the second is a table for Obligations, where we obligate funds from that allotment to specific businesses. The third table is for disbursements, where cash disbursements go out to those businesses from the obligated amounts from the allotments. My issue is that I need to be able to prevent end users from entering in monetary amounts into either the ObligationsAmount field in the Obligations table or the DisbursementAmount field in the Disbursement table that exceed the total amount of the AllotmentAmount in the Allotment table. If overages like that were to be posted and sent out, it would cause a deficit which would then precipitate an office wide SHTF situation.

    Would I use a Validation rule to construct something like that? And if so, how would I construct it?



    Thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't think can use the ValidationRule property. Use VBA code in textbox AfterUpdate procedure. Code could use DSum function.

    Problem with this kind of validation could arise if multiple users enter data simultaneously.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Long Tom Coffin is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    10
    Quote Originally Posted by June7 View Post
    I don't think can use the ValidationRule property. Use VBA code in textbox AfterUpdate procedure. Code could use DSum function.

    Problem with this kind of validation could arise if multiple users enter data simultaneously.

    June7-

    Thanks for the advice! Only problem is I have no experience with VBA whatsoever. I'm looking at some online tutorials and trying to understand how VBA works in the meantime. Would happen to have any advice/assistance for a new VBA user?


    Thanks!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Microsoft has a lot of info.
    For starters
    http://office.microsoft.com/en-us/ac...010341717.aspx

    Regarding your validation issue, correction, BeforeUpdate event might be better approach. Review:
    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
    In your case, the validation would be to retrieve data from tables and see if the additional data would exceed limit. This could use recordset or domain aggregate function (DLookup, DSum, DAvg, etc).
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Field rules/validation rules
    By sk88 in forum Access
    Replies: 14
    Last Post: 02-26-2012, 01:03 PM
  2. Question about Validation Rules
    By WilsonsW in forum Access
    Replies: 1
    Last Post: 04-18-2011, 05:06 PM
  3. Textbox data validation rules.....
    By smorelandii in forum Access
    Replies: 1
    Last Post: 02-01-2011, 09:52 PM
  4. Validation Rules
    By esglover in forum Database Design
    Replies: 1
    Last Post: 07-23-2010, 08:02 PM
  5. Validation rules question
    By cps6568 in forum Access
    Replies: 3
    Last Post: 01-12-2010, 02:01 PM

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