Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing the record navigation buttons

Status
Not open for further replies.

WCL01

Technical User
Oct 24, 2008
34
US
I'm attempting to access the record navigation buttons that normally sit at the bottom of a form. Specificly the current record and the total number of records that a give form has open. I'm not sure if there is a reference library that I need to install or some other command that I'm just missing.
 
Have a look at the form's Record Selectors property.

Hope this helps

HarleyQuinn
---------------------------------
You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Have a look at the AbolutePosition, RecordCount and RecordsetClone properties.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yep, I totally read that question incorrectly [wink]

HarleyQuinn
---------------------------------
You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
PHV,

I'm not sure what the AbolutePosition is. Is it supposed to be listed under me.forms. ? If so I don't have that particular reference libray installed.

If you wouldn't mind putting in the actual code to set lets say variable X = the total records in the form and how to set Y = the current record number. The reason for this is that I had to make my own record navigation buttons due to a few things that need to happen between each record on my form. I have some code that already counts up the total number of records but doesn't work for a couple of my forms and I want to be able to access the numbers that would normally be stored in the default navigation bar.
 
A starting point:
Code:
Me!someLabel.Caption = (Me.Recordset.AbsolutePosition + 1) & "/" & Me.Recordset.RecordCount

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

The AbsolutePosition seems to work however the recordcount is something I have already tried and it doesn't work (I did try it again per your advice). Because I'm in form view it just gives a value of 1 because that is all that is being displayed at the time. It does work in datasheet view if I pass it to a value and use debug to see what the value is. There has to be a way to access the actual values that access puts in those nav buttons at the bottom of the form.

This is how I currently do it however it won't work on my new form.

X is = to the total records

Code:
currentrecord1 = 1
Me.txtrecordnumber = currentrecord1
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim sql As Variant
Set dbs = CurrentDb()

If tafilter = "" Then
sql = "select count(id) as x from tatbl2"
Else
sql = "select count(id) as x from tatbl2 where " & tafilter
End If

Set rst = dbs.OpenRecordset(sql)
With rst
Me.txttotalrecords = !x
End With
rst.Close
dbs.Close

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top