Display # of records added

  • Thread starter Thread starter dkuntz
  • Start date Start date
D

dkuntz

Guest
I have a few users that enter new records via a data entry form.
I would like to have a label or textbox that continuously counts each new record a user adds in a given day. A user chooses his/her id from a combox on the same data entry form.

A user will click a 'Submit' button once they have entered all that they need to. After this the new record is stored and then they can begin entering a new record. I'm assuming the code would go in the Submit_Click() event. I'm having a little trouble getting started - any help is sincerely appreciated.

Thanks -
Derek
 
In the data table that your users are inputting information to; do you have fields for Date Entered and Entered by?
If you did then you could just query your table to count the number of entries for Date Enterred = Today() for current User.
 
Yes, for date entered: the current date is displayed by default
for entered by: this would be their ID in the cmbo box

I just put a new text box on the form called txtCount. Would you suggest:

Submit_Click()

Dim sMessage as string
sMessage = "SELECT * FROM ............."

txtCount = sMessage

End Sub
 
You could just build a query that calculates the number of entries per day per person and then place a DLookup in your Text box.

so your query would be:

SELECT Count([Data Table].User) AS CountOfUser
FROM [Data Table]
GROUP BY [Data Table].USER, [Data Table].[DATE ENTERED]
HAVING ((([Data Table].USER)= getUser()) AND (([Data Table].[DATE ENTERED])=Date()));

** getUser() isn't a function in Access I just put it in there as
** as example that you could create a getUser function.

Your txtCount Control Source would be:
=DLookup("CountOfUser", "CountQuery")

This probably isn't the best and most efficient way to do this, but again, it's Monday and I'm having a hard time thinking straight.

Anyway, hope this works for ya.
 
DCount is also an option.

Set the txtField control property = DCount(...)
 

Users who are viewing this thread

Back
Top Bottom