Click to navigate in subform

dr223

Registered User.
Local time
Today, 08:50
Joined
Nov 15, 2007
Messages
219
Hallo,

I have a subform which is built up of a field called Session (this field has values such as 02/03, 03/04, 05/06, 06/07 etc)

For a specific record you might have 2 or 3 similar values i.e., 02/03, 02/03, 05/06, 05/06, 05/06, 06/07.

I have this code on OnClick event which moves from one value to another and if the value is identical it jumps to the next. (Therefore it will only highlight 02/03 once then 05/06).

The problem is that if the value is more than 2 times, it will still highlight the third identical value. In the above example it will highlight 05/06, then 05/06, then 06/07. Though, I want it to display 05/06 ONLY once.

Form name: StudentDetails1
Subform name: FeesDetails
Field name: Session

The code is shown below;

Private Sub Command89_Click()

On Error GoTo Err_Command82_Click
Dim Pval As String
Pval = Forms![StudentDetails1]![FeeDetails]![Session]

DoCmd.OpenForm "StudentDetails1"
DoCmd.GoToControl "FeeDetails"
DoCmd.GoToControl "Session"
DoCmd.GoToRecord , , acPrevious
If Forms![StudentDetails1]![FeeDetails]![Session] = Pval Then
DoCmd.OpenForm "StudentDetails1"
DoCmd.GoToControl "FeeDetails"
DoCmd.GoToControl "Session"
DoCmd.GoToRecord , , acPrevious
Else
End If
Exit_Command82_Click:
Exit Sub

Err_Command82_Click:
MsgBox Err.Description
Resume Exit_Command82_Click

End Sub

Thank you very much
 

Users who are viewing this thread

Back
Top Bottom