Count current records entered on data input screen.

Jackpotgee

Registered User.
Local time
Today, 20:56
Joined
Jun 7, 2007
Messages
27
Hi,

I have have a data entry form from which i have removed the built in record navigation and replaced it with my own. I am trying to build a record counter that will display "record x of y" where "y" is the number of records entered in this session and not the total number of records in the table.

The code below works whilst entering new records but once you goto a previous record the total records displayed is the total in the table (1095) and not the total entered since the form was opened (3 for example).

Code:
Me.RecordNumber = [CurrentRecord] & " of " & IIf([NewRecord], [CurrentRecord], DCount("*", "Tbl_Referrals"))

Any clues on what I'm doing wrong?
 
you need to put something in the dcount to tell it that you want this session only

so how do you know what session each one is from?
 
Thanks for reply,

I have no markers in the table which identify which session the data was entered on.

Not sure that i have been clear enough in my explanation.
When you enter data onto a standard data entry form with navigation buttons, the form allows you to scroll through the most recent entries (only those that have been entered since the form was opened). It is this number i want to count. The standard access navigation panel provides this service but unfortunately i cant allow it on my form as it will also allow the bypass of all my validity checks.

It presumably must be possible as it is part of an automatic function of Access anyway?
 
well without access knowing what records to count specifically

dcount("*", tablename) counts all records in the table

your table doesnt have a dateentered or anything like that?
 
no, unfortunately it doesnt - there is a date, but multiple different dates could be entered in one session so that wouldnt work.

There must be some sort of identifier used by the standard Navigation Panel, or a temporary table of some sorts?
 
yea, if you want to count only the records entered per session.
 
Solved!

Solved for anyone who is interested with the help of Ghudsons code in RecordXofY

Code:
If Me.NewRecord Then
Me.RecordNumber = "NEW of " & Me.RecordsetClone.RecordCount
Else
Me.RecordNumber = [CurrentRecord] & " of " & Me.RecordsetClone.RecordCount
End If

The use of RecordsetClone.RecordCount ensures that just the records that are being currently entered are counted i.e. the current record set.
 

Users who are viewing this thread

Back
Top Bottom