473,378 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Record Y of X question

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
2 1828
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tim Marshall | last post by:
This is an embarrassing question to which I should know the answer, but I am not 100% sure of myself. My applications, whether they are Jet or Oracle usually deal with reporting on existing apps...
1
by: Tom Lee | last post by:
Hi Guys, Firstly thanks for all the help you have providing me... I have another question I was stuck with. Here is a simple code dim strsql as string dim scr as recordset
3
by: John Ortt | last post by:
> I have a table of dates in ascending order but with varying intervals. I > would like to create a query to pull out the date (in field 1) and then pull > the date from the subsequent record...
5
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for...
4
by: Richard | last post by:
In normal asp i used --------- objRS.Open "tbl_Nieuws", objConn, 1, 3 objRS.AddNew objRS.Fields("N_Datum") = FormatDateTime(Now(),2) objRS.Fields("N_Title") =...
9
by: Greg | last post by:
Binding Manager & dataset - won't add record I've got an untyped dataset with controls bound through code. The user can select a question number from a bound combobox, and the question number and...
0
by: jakev2003 | last post by:
I have a form that has values from many different tables. Here are the tables: - Questions(ID, UserID, Question) - Users(UserID, Name, Email_Address, Other_Info) So when I browse through...
1
by: Ryker | last post by:
I have a lengthy form containing several fields of data. Each record that is entered is given a record identification number. Sometimes the user gets midway into the form and has to stop to...
10
by: john | last post by:
In a form, when you arrive in a new record, what event is trigerred and in which object? I can't find such an event. I need to reset a value when the user arrives in a next record. Thanks, john
2
by: glynester | last post by:
I have some code that works off the update event of a textbox field (which is a part of a record in a continuous form). If certain conditions are met (following the updating of the field), I want a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.