Results 1 to 2 of 2
  1. #1
    kos2J is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Nov 2016
    Posts
    1

    Smile Display custom message box if duplicate value entered into form

    Hello

    I am pretty new to Access 2016 and this forum so apologies if this has come up before, though I didn't see it.

    I have a form in my database called NewRequests. One of the fields is for an ISBN number stored as short text. If a duplicate value is entered, matched to the table that stores form data Requests2015/16 or a table called RequestsArchive I would like a message box to display that pulls out the previous request number, for example "please not this book has previously been requested, see requests number..."



    As multiple service users can request the same book I don't want to stop the request but for the form user to realize a copy is on record.

    Can anyone point me in the right direction here?

    many thanks
    kos2j

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    1. if the table is keyed on ISBN then you cannot get a duplicate. The message will appear on its own.

    2.if you didnt key the table, then in the form, when the user enters the ISBN ,the afterupdate event can look it up:
    Code:
    sub txtISBN_afterupdate()
    vRet = Dlookup("[isbn]","table","[isbn]='" & txtISBN & "'")
    if not IsNull(vRet) then msgbox "This book has previously been requested, see requests number"
    end sub

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

Similar Threads

  1. Replies: 4
    Last Post: 01-14-2016, 02:18 PM
  2. Compare if duplicate and display message
    By chotroi in forum Access
    Replies: 7
    Last Post: 03-22-2014, 02:53 PM
  3. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  4. Replies: 6
    Last Post: 01-07-2013, 06:41 PM
  5. Replies: 13
    Last Post: 12-31-2012, 10:41 PM

Tags for this Thread

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