473,508 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I dsiplay the number of records on the form (same as bottom left corner)

7 New Member
Hi!

I would like to display the number of a record and the total numbers of records on that form. Basically what Access already does in the bottom left corner, I would like to have somewhere bigger on the form.

For example in a Text Box you are on record 3, it shows [3 of 20]

Thanks a lot !
Jun 8 '10 #1
7 1806
ADezii
8,834 Recognized Expert Expert
@UDontKnowJack
Assuming you have a Label named lblRecCount on your Form, place the following code in the Form's Current() Event:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. If Me.NewRecord Then
  3.   Me![lblRecCount].Caption = "[" & Format$(Me.CurrentRecord, "#,###") & " of " & _
  4.                               Format$(Me.Recordset.RecordCount + 1, "#,###") & "]"
  5. Else
  6.   Me![lblRecCount].Caption = "[" & Format$(Me.CurrentRecord, "#,###") & " of " & _
  7.                               Format$(Me.RecordsetClone.RecordCount, "#,###") & "]"
  8. End If
  9. End Sub
Jun 8 '10 #2
UDontKnowJack
7 New Member
Thanks!

Works Perfectly!
Jun 10 '10 #3
NeoPa
32,557 Recognized Expert Moderator MVP
FYI. For large numbers of records the total count may not always be available immediately. If this is a problem for your design you could check the value first, and if it's not yet available then go to the last record then back again. Once the whole recordset has been traversed the values will be available.
Jun 10 '10 #4
UDontKnowJack
7 New Member
Hi,

How can i check the value first... is there a way to make it work properble at the start?

THanks
Jun 10 '10 #5
NeoPa
32,557 Recognized Expert Moderator MVP
In my testing it returned a value (the number of records accessed so far) even when the whole dataset had not been accessed. From that it is hard to tell how accurate the figure actually is. If this is important to you (it seems it is) then I would compare the value to 1 immediately after opening. If <=1 then do a MoveLast() followed by a MoveFirst(). If, worst case, the recordset consists of only one record, then very little time has been wasted. It should always reflect the correct value though.
Jun 10 '10 #6
UDontKnowJack
7 New Member
Sorry my VBA knowledge is very limited. Could you be so kind putting into code and then where to squeeze it into the abouve code from ADezzi ...

Thanks a lot!
Jun 10 '10 #7
NeoPa
32,557 Recognized Expert Moderator MVP
This code would go into the Form_Open() event procedure, rather than the Form_Current() one as ADezii used.

For completeness I've included versions for both :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     With Me.Recordset
  3.         If .RecordCount <= 1 Then
  4.             Call .MoveLast()
  5.             Call .MoveFirst()
  6.         End If
  7.     End with
  8. End Sub
  9.  
  10. Private Sub Form_Current()
  11.     With Me
  12.         .lblRecCount.Caption = _
  13.             "[" & Format(.CurrentRecord, "#,##0"") & _
  14.             " of " & _
  15.             Format(.Recordset.RecordCount + IIf(.NewRecord, 1, 0), _
  16.                    "#,##0") & "]"
  17.     End with
  18. End Sub
Jun 10 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
11960
by: mercurius_1 | last post by:
I want to put text for a copyright notice into the bottom right corner of my page. When I say "bottom right," I mean that it will float there regardless of how the browser window is resized. I...
2
1471
by: Rednelle | last post by:
Greetings all. Please help a real beginner using Access 2000. During experimentation with this program I have deleted many records from my main Table but the bottom left window always shows...
1
1500
by: Stijn Goris | last post by:
hi all, I want to show a frame at the bottom left corner. Some knows how I can do this? I know this.StartPosition = FormStartPosition.Manual but have no ideaa on how to alter the Manual...
1
1689
by: johannblake | last post by:
I want to create a scrollable window using GDI+ where the origin is located in the bottom-left corner rather than the default top-left corner. Currently I have found several examples on how to...
14
3698
by: dutch90 | last post by:
Hi I want to make my header table (with the logo and nav menu) start at 0,0. I tried body {margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding:0px;} but I...
1
4117
by: igpig | last post by:
Sorry if this has been asked before. I've searched the group and the FAQ and didn't find the answer. How can I retrieve x, y coordinates of the browser top left corner in Internet Explorer? ...
4
5239
by: Andre Majorel | last post by:
How do you align an <imgagainst the bottom-right corner of an enclosing block so that the text in the block flows around it ? <!-- Block begins here --> <p> En ce qui concerne la conjoncture...
0
1293
by: Polaris431 | last post by:
I have spent hours through newsgroups and googling but I am at a loss how to move the drawing origin from the top left corner to the bottom left corner and have Y values increase towards the top. ...
2
3132
by: JB | last post by:
Hi All, I'd like to display a "resize handle" in the bottom right corner of a form like in the windows explorer for instance (the 3 diagonal lines in the corner). Can anybody tell me how to do...
3
1524
by: Abhiraj Chauhan | last post by:
Hello. I want to set my coordinate-system-origin (0/ 0) to the bottom-left corner. How is that done in VB.net the best way? thanks.
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.