Hi All,
On my form I've got an afterupdate event that checks if the information entered already exists and this works absolutely fine. However what I would like is the option to go to the existing record if one is found, but I can't get it to work.
This is my code currently;
The check for the Job Number works fine but when I click Yes on the message box, the form stays on the current record instead of moving to the existing record.
Any help?
Thanks guys
On my form I've got an afterupdate event that checks if the information entered already exists and this works absolutely fine. However what I would like is the option to go to the existing record if one is found, but I can't get it to work.
This is my code currently;
Code:
Private Sub Job_No_AfterUpdate()
If DCount("*", "PACKING", "[Job No>]='" & Me.[Job No] & "'") > 0 Then
If MsgBox("Job Number already exists! Go to record?", vbYesNo, "DST PLANNER") = vbYes Then
Dim rs As Object
Dim lngBookmark As Long
lngBookmark = Me.[Job No>]
DoCmd.OpenForm "Packing"
Set rs = Forms!Packing.RecordsetClone
rs.FindFirst "[Job No>] =" & lngBookmark
Forms!Packing.Bookmark = rs.Bookmark
Set rs = Nothing
Else
DoCmd.CancelEvent
End If
End If
End Sub
The check for the Job Number works fine but when I click Yes on the message box, the form stays on the current record instead of moving to the existing record.
Any help?
Thanks guys