rkellogg518
Technical User
I have a data base that tracks milage, working time, according to rep. I am trying to get the stop milage form to check to see if a record with the same date and rep exists if so then edit the existing record if not then create a new record.
I have tried it with the following code in VB but continually get errors.
Private Sub Combo7_AfterUpdate()
Dim strSQL As String
Dim lngKey As Long
lngKey = Nz(DLookup("Firstname", "rep", "[RepID] = " & Me.Combo7 & " AND [Mileage_Date] = #" & DATE & "#"), 0)
If lngKey <> 0 Then
Me.Undo
Me.RecordsetClone.FindFirst "firstname = " & lngKey
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub
Any help would be appreciated.
I have tried it with the following code in VB but continually get errors.
Private Sub Combo7_AfterUpdate()
Dim strSQL As String
Dim lngKey As Long
lngKey = Nz(DLookup("Firstname", "rep", "[RepID] = " & Me.Combo7 & " AND [Mileage_Date] = #" & DATE & "#"), 0)
If lngKey <> 0 Then
Me.Undo
Me.RecordsetClone.FindFirst "firstname = " & lngKey
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub
Any help would be appreciated.