Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,824
    Yep, and now I see original attempt should have been NOT IsNull()

    If Not IsNull(DLookup("Citation_Num", "NODLog_tbl", "Citation_Num = '" & Me.txtCitationNum & "'")) Then

    So the variable shouldn't really be needed.



    Yes, Undo is nice to have so user doesn't have to manually undo.
    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.

  2. #17
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    I swear I tried the If Not IsNull and that also didn't work but maybe I was doing it wrong. Anyway, it seems to be working pretty good however, I have some save, next, and previous buttons to flip through records and if the form is dirty and I click on one of those buttons then it causes some unwanted save prompts that I made to show up because of this duplicate check.

    I was wondering if you could help me alter the code to get this duplicate check to just notify the user of the duplicate found and ask if they would like to proceed or not? In other words, make it their choice to create the duplicate record if they choose to do so. Is that possible?

    I was thinking of doing something like this:

    Dim CheckDUP As Variant
    CheckDUP = DLookup("[Citation_Num]", "NODLog_tbl", "[Citation_Num] = '" & Me.txtCitationNum & "'")
    If Not IsNull(CheckDUP) Then
    If MsgBox ("NOD Already Sent." & vbCrLf & "Would you like to proceed?", vbYesNo + vbQuestion) = vbYes Then
    Exit Sub
    Else
    Cancel = True
    Me.txtCitationNum.Undo
    End If
    Else:
    End If

  3. #18
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,824
    Should work. Try it.

    Could simplify:
    Code:
    Dim CheckDUP As Variant
    CheckDUP = DLookup("[Citation_Num]", "NODLog_tbl", "[Citation_Num] = '" & Me.txtCitationNum & "'")
    If Not IsNull(CheckDUP) Then
       If MsgBox ("NOD Already Sent." & vbCrLf & "Would you like to proceed?", vbYesNo + vbQuestion) = vbNo Then
            Cancel = True
           Me.txtCitationNum.Undo
       End If
    End If
    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. #19
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Worked like a charm. Thank you so much for the help.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-01-2018, 12:37 PM
  2. Keep textbox in same place when lost focus
    By aytee111 in forum Forms
    Replies: 2
    Last Post: 12-13-2016, 03:59 PM
  3. Combo Box Values to Go Blank on Lost Focus
    By McArthurGDM in forum Forms
    Replies: 6
    Last Post: 02-20-2015, 01:22 PM
  4. Replies: 3
    Last Post: 01-18-2014, 02:20 PM
  5. hide a list box on lost focus
    By markjkubicki in forum Programming
    Replies: 2
    Last Post: 08-18-2012, 10:32 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