Dupicate Records

mugman17

Registered User.
Local time
Today, 03:40
Joined
Nov 17, 2000
Messages
110
I have a form based on a table that I would like to lookup any records that are similiar to the one about to be saved. I know I need to creat a string a then most likely a DLookup to look for the values. But I am having troubles with the syntax. The fields are Quantity, Price, SupplierID, and Date.

Thanks.
 
I have a form for teammates that logs info for each teammate with a search field at the top so that I can search for duplicate records first. Here is the code I used for the search "After Update" and if they are not in the list it will create a new record for them... maybe you can use it and model it after your data.
Private Sub Combo10_AfterUpdate()
On Error GoTo Err_Combo10_AfterUpdate
Dim rs As Recordset
Dim strNewUser As String
Dim strSQL As String

If Not IsNull(Me.Combo10.Value) Then
Set rs = Me.RecordsetClone
rs.FindFirst "UserID = '" & Me.Combo10 & "'"
If rs.NoMatch Then
strNewUser = InputBox("Enter New UserID", "Add New User?", Me.Combo10.Value)
If strNewUser = "" Then
Me.Combo10 = ""
Else
strSQL = "Insert Into tblUsers(UserID) Values('" & strNewUser & "')"
CurrentDb.Execute strSQL, dbFailOnError
Me.Form.Requery
Me.Combo10.Requery
Set rs = Me.RecordsetClone
rs.FindFirst "UserID = '" & strNewUser & "'"
Me.Bookmark = rs.Bookmark
End If
Else
Me.Bookmark = rs.Bookmark
End If
End If
Me.Combo10 = ""
Exit Sub

Err_Combo10_AfterUpdate:
MsgBox Err.Description

End Sub
 

Users who are viewing this thread

Back
Top Bottom