After cycling through records with form return to main form

charlie442

Registered User.
Local time
Today, 08:33
Joined
Jan 14, 2011
Messages
53
Hi

I have a form which allows team leaders to verify information that their team members have captured. It all works fine while they are verifying records and moving onto the next record, but when it gets to the last record it obvioulsy cant go on to the next record and the verifier gets stuck here. Essentially there is a button which checks the field 'Verified' and populates the date and team leader employee number and moves onto the next record, with code below:

Code:
Private Sub cmdViewNext_Click()
Me.Verified = True
Me.Date_Verified = Date
Me.Manager_Verified = fOSUserName()
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , , acNext
If Error Then
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "frmMainForm"
End If
End Sub

I am a real amateur when it comes to VBA so clearly what I have written must look like garbage to the gurus, but if you guys could point me in the right direction I would be so happy. Thanks
 
On the every form there are a NAVIGATION BUTTONS.
 
See if this does what you need:
Code:
Private Sub cmdViewNext_Click()

Me.Verified = True
Me.Date_Verified = Date
Me.Manager_Verified = fOSUserName()
DoCmd.RunCommand acCmdSaveRecord

If CurrentRecord = RecordsetClone.RecordCount Then
   MsgBox "You are on the Last Record! Time to Go Home!"
   DoCmd.Close acForm, Me.Name
   DoCmd.OpenForm "frmMainForm"
Else
    DoCmd.GoToRecord , , acNext
End If

End Sub
Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom