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 !
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: - Private Sub Form_Current()
-
If Me.NewRecord Then
-
Me![lblRecCount].Caption = "[" & Format$(Me.CurrentRecord, "#,###") & " of " & _
-
Format$(Me.Recordset.RecordCount + 1, "#,###") & "]"
-
Else
-
Me![lblRecCount].Caption = "[" & Format$(Me.CurrentRecord, "#,###") & " of " & _
-
Format$(Me.RecordsetClone.RecordCount, "#,###") & "]"
-
End If
-
End Sub
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.
Hi,
How can i check the value first... is there a way to make it work properble at the start?
THanks
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.
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!
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 : - Private Sub Form_Current()
-
With Me.Recordset
-
If .RecordCount <= 1 Then
-
Call .MoveLast()
-
Call .MoveFirst()
-
End If
-
End with
-
End Sub
-
-
Private Sub Form_Current()
-
With Me
-
.lblRecCount.Caption = _
-
"[" & Format(.CurrentRecord, "#,##0"") & _
-
" of " & _
-
Format(.Recordset.RecordCount + IIf(.NewRecord, 1, 0), _
-
"#,##0") & "]"
-
End with
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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...
|
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...
| |
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?
...
|
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...
|
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.
...
|
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...
|
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.
|
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,...
| |
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...
|
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...
|
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...
|
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,...
|
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...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |