skwilliams
Registered User.
- Local time
- Today, 13:36
- Joined
- Jan 18, 2002
- Messages
- 516
I have a tabular form "frmReprintInput" used for inputting data. This form stores data in the table "tblReprints". I would like to display a message box if a duplicate order number "Order" already exists, but allow the input of this duplicate order number. The field and control for Order is a Long Integer. I've tried this code, but it's not working. Is there a better way to accomplish this?
Code:
Dim Od As Long
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
Od = Me.Order.Value
stLinkCriteria = "[Order]=" & "'" & Od & "'"
'Check tblReprints table for duplicate Order Number
If DCount("Order", "tblReprints", stLinkCriteria) > 0 Then Me.Order=Od
MsgBox "Duplicate Order Number"
'Go to Original Order Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
Set rsc = Nothing