F
Find Record Add New or Update Table
I have a form with a subform add new records to a table, however, our
supplier is sending back products with the same serial number (table does not
allow duplicates) for serials. I do not want duplicates, but want to be able
to find that serial in the table and update data or add new serials if not
found. It was set up to find first autoid and enter information in subform.
Here is my code for form; can someone help????
Option Compare Database
Private Sub Combo6_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[AutoID] = " & Str(Me![Combo6])
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Combo8_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[AutoID] = " & Str(Me![Combo8])
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Command14_Click()
On Error GoTo Err_Command14_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command14_Click:
Exit Sub
Err_Command14_Click:
MsgBox Err.Description
Resume Exit_Command14_Click
End Sub
Private Sub Combo8_Exit(Cancel As Integer)
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End Sub
Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Command15_Click:
Exit Sub
supplier is sending back products with the same serial number (table does not
allow duplicates) for serials. I do not want duplicates, but want to be able
to find that serial in the table and update data or add new serials if not
found. It was set up to find first autoid and enter information in subform.
Here is my code for form; can someone help????
Option Compare Database
Private Sub Combo6_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[AutoID] = " & Str(Me![Combo6])
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Combo8_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[AutoID] = " & Str(Me![Combo8])
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Command14_Click()
On Error GoTo Err_Command14_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command14_Click:
Exit Sub
Err_Command14_Click:
MsgBox Err.Description
Resume Exit_Command14_Click
End Sub
Private Sub Combo8_Exit(Cancel As Integer)
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End Sub
Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Command15_Click:
Exit Sub