By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,830 Members | 1,722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,830 IT Pros & Developers. It's quick & easy.

Check Duplicate & Ask for Re Entry

P: 58
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.

Attached Files
File Type: zip (129.3 KB, 78 views)
May 12 '10 #1

✓ answered by irsmalik

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

Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,445

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

Expand|Select|Wrap|Line Numbers
  1. Private Sub DRAWING_BeforeUpdate(Cancel As Integer)
  2.     Dim dwg
  3.     dwg = DLookup("[DRAWING]", "DRAWINGS")
  4.     If dwg = Me.DRAWING Then
  5.        MsgBox "Drawing Number is already Exist. Please Try another...",  _
  6.            vbCritical, "Duplicate Entry"
  7.        Cancel = True
  8.     End If
  9. End Sub
May 12 '10 #2

P: 58
Thank very much Veena ...... It really works....
Thank U again.. bye
May 12 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.