How do I add a record counter to my form

G

gagecres

Boom! This worked perfectly. Thanks for sticking with me on this.

Gina Whipp said:
Okay, then let's forget that and use this...

Create a text box and copy/paste the below...

=IIf([CurrentRecord]>(Count(*)),'No Record',('Contract ' & [CurrentRecord] &
' of ' & Count(*))) & " line(s)"


Note, where is says 'No Record', you can have it say anything or nothing.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

The code you gave me works fine if the first parent record that appears on
the form has records in the subform. If that first parent record has no
records in the subform, that's when I get the "No Current Records" error as
soon as I open the database and the debugger highlights the ".MoveLast"
statement.

Gina Whipp said:
Is me txtRec_Count a numeric field? OR just and unbound text box? Please
remove *.Value* Is this a form or subform and does it have any records?

What message if any do you get?

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Here is the code I am using:

With Me.RecordsetClone
.MoveLast
Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " & .RecordCount
&
" line(s)"
End With

Also, I commented out the OnLoad lines



.

.
 
G

Gina Whipp

gagecres,

No problem... thanks for posting back and letting us know!

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Boom! This worked perfectly. Thanks for sticking with me on this.

Gina Whipp said:
Okay, then let's forget that and use this...

Create a text box and copy/paste the below...

=IIf([CurrentRecord]>(Count(*)),'No Record',('Contract ' & [CurrentRecord]
&
' of ' & Count(*))) & " line(s)"


Note, where is says 'No Record', you can have it say anything or nothing.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

The code you gave me works fine if the first parent record that appears on
the form has records in the subform. If that first parent record has no
records in the subform, that's when I get the "No Current Records" error
as
soon as I open the database and the debugger highlights the ".MoveLast"
statement.

Gina Whipp said:
Is me txtRec_Count a numeric field? OR just and unbound text box?
Please
remove *.Value* Is this a form or subform and does it have any records?

What message if any do you get?

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Here is the code I am using:

With Me.RecordsetClone
.MoveLast
Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " &
.RecordCount
&
" line(s)"
End With

Also, I commented out the OnLoad lines



.

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top