By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,477 Members | 1,602 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,477 IT Pros & Developers. It's quick & easy.

Record Y of X question

P: n/a
I am trying to make a custom navigation label to display record Y of X.
Dev Ashish's code placed in the OnCurrent Event:

Private Sub Form_Current()
If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate.Caption = "Record " & _
.AbsolutePosition + 1 _
& " of " & .RecordCount
End With
End If
End Sub

I have a Sort Option Box that allows the user to select custom sorts.
I placed the following code in the AfterUpdate Event of the option box:
Select Case Me.optSortRecords.Value
Case 1
Me.FilterOn = False
Case 2
Me.Filter = "[DelegatedTo] Is Null"
Me.FilterOn = True
Case 3
Me.Filter = "[DelegatedTo] Is Not Null"
Me.FilterOn = True
Case 4
Me.Filter = "[DelegatedTo] Is Not Null"
Me.FilterOn = True
End Select

However, when a option is selected, it doesnt appear to update the
custom navigation count. I even tried placing Dev's code in the the
AfterUpdate code of the option box, with no luck.

Any suggestions?

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
BerkshireGuy wrote:
I am trying to make a custom navigation label to display record Y of X.
Dev Ashish's code placed in the OnCurrent Event:

Private Sub Form_Current()
If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate.Caption = "Record " & _
.AbsolutePosition + 1 _
& " of " & .RecordCount
End With
End If
End Sub

I have a Sort Option Box that allows the user to select custom sorts.
I placed the following code in the AfterUpdate Event of the option box:
Select Case Me.optSortRecords.Value
Case 1
Me.FilterOn = False
Case 2
Me.Filter = "[DelegatedTo] Is Null"
Me.FilterOn = True
Case 3
Me.Filter = "[DelegatedTo] Is Not Null"
Me.FilterOn = True
Case 4
Me.Filter = "[DelegatedTo] Is Not Null"
Me.FilterOn = True
End Select

However, when a option is selected, it doesnt appear to update the
custom navigation count. I even tried placing Dev's code in the the
AfterUpdate code of the option box, with no luck.

Any suggestions?


Why not just use the Navigation buttons? It shows the Record X of Y.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Nov 13 '05 #2

P: n/a
Sorry for my english.
I think that the problem of the recordcount and absoluteposition is that
they are properties of the recordset asociated with the form, so if you
filter it, you are not changing the recordset. My solution will be that when
you change the option box you will do the filter as an SQL statement
changing the Recordsource property of the form. It will do that the
recorcount and absolute position will be OK.

Select Case Me.optSortRecords.Value
Case 1
Me.RecordSource = "SELECT * FROM YourTable"
Case 2
Me.RecordSource = "SELECT * FROM YourTable WHERE DelegatedTo IS NULL"
........................

Another suggestion is that you have to be carefull with the AbsolutePosition
property because it will not return any good value depending on the type of
recordset (dynamic and forwardonly will fail) and if you use it with a DAO
it is base 0 and if you use it with an ADO it is base 1.

"BerkshireGuy" <bd*****@yahoo.com> escribió en el mensaje
news:11*********************@g44g2000cwa.googlegro ups.com...
I am trying to make a custom navigation label to display record Y of X.
Dev Ashish's code placed in the OnCurrent Event:

Private Sub Form_Current()
If Me.NewRecord Then
Me!lblNavigate.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate.Caption = "Record " & _
.AbsolutePosition + 1 _
& " of " & .RecordCount
End With
End If
End Sub

I have a Sort Option Box that allows the user to select custom sorts.
I placed the following code in the AfterUpdate Event of the option box:
Select Case Me.optSortRecords.Value
Case 1
Me.FilterOn = False
Case 2
Me.Filter = "[DelegatedTo] Is Null"
Me.FilterOn = True
Case 3
Me.Filter = "[DelegatedTo] Is Not Null"
Me.FilterOn = True
Case 4
Me.Filter = "[DelegatedTo] Is Not Null"
Me.FilterOn = True
End Select

However, when a option is selected, it doesnt appear to update the
custom navigation count. I even tried placing Dev's code in the the
AfterUpdate code of the option box, with no luck.

Any suggestions?

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.