Check Duplicate & Ask for Re Entry

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • irsmalik
    New Member
    • May 2010
    • 102

    Check Duplicate & Ask for Re Entry

    Hi Friends,
    I am developing Engineering Document System which keep the record for all kind of Engineering Drawings and other related documents in MS Access + VBA. Table Details are
    Drawing No, Sheet From, Sheet To, Title and Revision
    My Question is
    When I enter Drawings No it may tell me that "This Drawing No is Already Exist"
    and Cursor may not go to Next Field until the correct Drawing Number is entered.

    I used DLoopup function which gives message about Duplicate Entry. But the cursor not go back for Re Entry.

    Kindly help me to solve this by VBA code in BeforeUpdate event.

    thanks
    Attached Files
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Remove the code written in AfterUpdate... write it in BeforeUpdate event :

    [CODE=vb]
    Private Sub DRAWING_BeforeU pdate(Cancel As Integer)
    Dim dwg
    dwg = DLookup("[DRAWING]", "DRAWINGS")
    If dwg = Me.DRAWING Then
    MsgBox "Drawing Number is already Exist. Please Try another...", _
    vbCritical, "Duplicate Entry"
    Cancel = True
    End If
    End Sub
    [/CODE]

    Regards
    Veena

    Comment

    • irsmalik
      New Member
      • May 2010
      • 102

      #3
      Thank very much Veena ...... It really works....
      Thank U again.. bye

      Comment

      Working...