From: gagecres on
I would like to add my own record counter, like "Record # of #", to my form.
How can I do this?
From: Linq Adams via AccessMonster.com on
Private Sub Form_Load()
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acFirst
End Sub


Private Sub Form_Current()
Me.Caption = "Record " & CurrentRecord & " Of " &
RecordsetClone.RecordCount & " Records"
End Sub

This code places the info in the form's title area. To place it in a Label,
substitute

Me.LableName.Caption

for

Me.Caption.

To place it in a TextBox, substitute

Me.TextBoxName.Value

for

Me.Caption.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1

From: Linq Adams via AccessMonster.com on
Sorry, meant to add this caveat:

This only displays the position of a record within the RecordSource of the
form. It has nothing to do with its position within the underlying table.
Additions and deletions will change this, assuming the RecordSourse is
requeried after each of these is done.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1

From: gagecres on
This worked great! Thanks a lot. One question though. I get an error on
the "DoCmd.GoToRecord , , acNext" line when I first open the form. I assume
this is because there are no records in the database yet. How do I fix this?

"Linq Adams via AccessMonster.com" wrote:

> Private Sub Form_Load()
> DoCmd.GoToRecord , , acNext
> DoCmd.GoToRecord , , acFirst
> End Sub
>
>
> Private Sub Form_Current()
> Me.Caption = "Record " & CurrentRecord & " Of " &
> RecordsetClone.RecordCount & " Records"
> End Sub
>
> This code places the info in the form's title area. To place it in a Label,
> substitute
>
> Me.LableName.Caption
>
> for
>
> Me.Caption.
>
> To place it in a TextBox, substitute
>
> Me.TextBoxName.Value
>
> for
>
> Me.Caption.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1
>
> .
>
From: gagecres on
I also noticed that the total records number always starts out as 1, even if
I have more than 1 record in the subform associated with the current record
on the parent form. For example, it says "Record 1 of 1" even though there
are a total of 3 records. However, when I go to the next record in the
subform it updates to the correct number of total records (i.e. "Record 1 of
3"). How do I get it to say "Record 1 of 3" for the subform record when I
first get to the parent record?

"Linq Adams via AccessMonster.com" wrote:

> Private Sub Form_Load()
> DoCmd.GoToRecord , , acNext
> DoCmd.GoToRecord , , acFirst
> End Sub
>
>
> Private Sub Form_Current()
> Me.Caption = "Record " & CurrentRecord & " Of " &
> RecordsetClone.RecordCount & " Records"
> End Sub
>
> This code places the info in the form's title area. To place it in a Label,
> substitute
>
> Me.LableName.Caption
>
> for
>
> Me.Caption.
>
> To place it in a TextBox, substitute
>
> Me.TextBoxName.Value
>
> for
>
> Me.Caption.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1
>
> .
>