Darryl Collins
Darryl.Collins at coles.com.au
Thu Sep 4 19:14:20 CDT 2008
Cool! Thanks for that Dan. Will have a play with this for sure.
regards
Darryl
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Dan Waters
Sent: Friday, 5 September 2008 1:06 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Counting Records on Form (when Nav buttons are
turned off)
Hi Darryl,
I've use this method on continuous forms for several years - requerying or
refreshing is not needed.
First, create a public function like this:
--------------------------------------------------
Public Function RowNumber(frm As Form) As Variant
On Error GoTo EH
'-- This is used to number records on a continuous form
If frm.Recordset.RecordCount = 0 Then
'-- This shows the number 1 for the first record _
even if there are no records yet.
RowNumber = 1
Else
frm.RecordsetClone.Bookmark = frm.Bookmark
RowNumber = frm.RecordsetClone.AbsolutePosition + 1
End If
Exit Function
EH:
Application.Echo True
GlngErrNumber = Err.Number
GstgErrDescription = Err.Description
Select Case GlngErrNumber
Case 3021
'-- blank row
Exit Function
Case 7951
'-- removed table behind form while deleting a record
Exit Function
Case Else
Call GlobalErrors()
End Select
End Function
--------------------------------------------------
Next, in an unbound textbox, enter the following:
--------------------------------------------------
=IIf([txtRecordID] Is Null,"",RowNumber([Form]))
--------------------------------------------------
Now, as you scroll up and down in the continuous form, the textbox will
display the correct record number.
HTH,
Dan
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darryl Collins
Sent: Thursday, September 04, 2008 12:28 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Counting Records on Form (when Nav buttons are turned
off)
Hi All,
Am sure this is easy (which usually means it turns out to be absurdly
complicated!!). I have my own custom Nav button on the bottom of a form,
but it would be nice to have: "Record x of y" showing somewhere down the
bottom like it does when you have the built in Nav buttons visible.
I tried to search for this, but I must be getting the syntax wrong (or the
words are too common - not really getting the results I need).
Any pointers?
Cheers
Darryl
This email and any attachments may contain privileged and confidential
information
and are intended for the named addressee only. If you have received this
e-mail in
error, please notify the sender and delete this e-mail immediately. Any
confidentiality, privilege or copyright is not waived or lost because this
e-mail
has been sent to you in error. It is your responsibility to check this
e-mail and
any attachments for viruses. No warranty is made that this material is free
from
computer virus or any other defect or error. Any loss/damage incurred by
using this
material is not the sender's responsibility. The sender's entire liability
will be
limited to resupplying the material.
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
This email and any attachments may contain privileged and confidential information
and are intended for the named addressee only. If you have received this e-mail in
error, please notify the sender and delete this e-mail immediately. Any
confidentiality, privilege or copyright is not waived or lost because this e-mail
has been sent to you in error. It is your responsibility to check this e-mail and
any attachments for viruses. No warranty is made that this material is free from
computer virus or any other defect or error. Any loss/damage incurred by using this
material is not the sender's responsibility. The sender's entire liability will be
limited to resupplying the material.