Results 1 to 4 of 4
  1. #1
    MdHaziq is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Singapore
    Posts
    124

    Validation Rule

    Hello


    Forum,

    I have a button in my subform, [Forms]![frmLog]!, that has an edit query to my master form, [Forms]![frmMaster]. I have a validation rule for one of my controls, [Forms]![frmMaster]![CurrentQty] >= [Forms]![frmLog]![UserQty].

    When I click on the button it prompts and does not edit my qty but the validation message is not what I wanted when I set it in [Forms]![frmMaster]![CurrentQty] validation text.

    Can someone help me out, please?

    TIA

    Haziq
    Attached Files Attached Files

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    MdHazia-ECD inv DB for 26Dec-v1 .zip
    The update query that you had will update every record in tblMaster, as it has wrong criteria specified.
    Try the above attachment. I got rid of the macro that called the update query (you can delete that query), and put the correct update query syntax
    in the button_click event for the log form which uses currendb.execute to run the query string.
    You will probably want to edit my code to prevent a withdrawal that would result in a negative quantity.

    Your project will not compile clean as you have several syntax errors in the code.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Saving calculated data especially aggregate data is usually a bad design. Aggregate data should be calculated from transaction records.
    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.

  4. #4
    MdHaziq is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Singapore
    Posts
    124
    Thanks guys for your help.

    June7, I will work on using transaction records for aggregate data.

    davegri, thanks for the code!

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

Similar Threads

  1. Replies: 4
    Last Post: 12-05-2017, 03:31 PM
  2. Replies: 2
    Last Post: 06-16-2015, 03:52 AM
  3. Validation Rule
    By JeffGeorge in forum Forms
    Replies: 4
    Last Post: 02-27-2015, 04:12 PM
  4. IIf in Validation Rule
    By Bugsy in forum Access
    Replies: 6
    Last Post: 11-21-2011, 11:33 AM
  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