Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access - need to compare entries in a form and error if they don't match

    Hi, I am very new to Access so please be nice. I will try and phrase this question the best I can.

    I have a form that users select a UPC number and then the associated item description is displayed below.

    Then in the same form the user then selects the finished goods number and the associated item description is below that.

    The purpose of this is to make sure the right label goes on the right product, so the item description for the UPC and for the finished goods number need to be the same. If they are not the same I would like an error message to pop up saying they don't match.

    I have no clue how to make this happen. I've tried searching for similar issues and found nothing. Any input would be awesome.

    p.s. I am using Access 2010

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    I'm assuming this is a bound form. If so, in your form's BeforeUpdate event you need something like this:

    If txtUPCDescription<>txtFinishedGoodsDescription then
    msgbox "The descriptions don't match", vbCritical,"Error!"
    Cancel=True
    exit sub
    End if

    This will prevent the form from saving the info on it until the 2 fields match.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    New Lounger
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you! I will try this first thing Monday when I'm back at work. My attempts were similar but this looks like exactly what I need. I will let you know how it goes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •