Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create a counter to keep track of how many Records are Return

Status
Not open for further replies.

MsPeppa

Programmer
Jun 27, 2001
19
US
I have a query that the user enters a start date and an end date. What I want to do is add a field so that there is a running total of how many records are listed. So like next to each record there is a number in that row.

(i.e.)

1 Lucy Liu
2 Xena


...and so on, and let's say the user searches again and the returned info is different then the count will start over at 1. Thanks
 
In this case I would create a field called record number. Make this a number field. Create an add new record button, and go into the on click section where the code lies. at the top of the section writeAt the very top of the page write
Dim num as double

then in the section of the code for the button writethe following which will store the last number created

DoCmd.GoToRecord , , acLast
num = [recor number]

Now enter your code to create a new reocrd, and after that code is done enter the following code which will take the number we recorded before and add 1 to it. Do this just before the end sub function


[customer number] = num + 1
DoCmd.GoToRecord , , acPrevious

 
That seems like it would work but not for this. My search opens a query, so I really don't have a form, it's only a query that is opened and depending on what the user searches for, that is how many records will appear so the number of matching criteria records changes all the time. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top