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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form populate

Status
Not open for further replies.

jewel

Technical User
May 23, 2001
158
NZ
hey all - Happy New Year

I have a form that after keying in the date will give you all calls for that day (help Desk)

How would I (maybe in a text box) on open show the total calls for the day.

eg - Label = Help Desk Calls and beside this (total Calls)

aprreciate sending me in right direction.

cheers
 
look at the dcount function
in a textbox. Need to use your field and table names

=dcount("recid","Callstbl"[datefieldname]= #" & Date() & "#")
 
thanks braindead2 for your answer

but I'm not quite there yet. Been playing a little as I kept getting errors.

=DCount("IDNO","tblprob",[Date]="#")

but this just gets a 0 count.

I click a command button that is linked to my form - I am asked to key in a date which is a parameter on my query for the form.(dd/mm/yyyy. So which part do I need to add back in regarding the date?

cheers
 
if you put this on a test box on your form it should return all the records from today

=dcount("IDNO","tblprob",[date]= #" & Date() & "#")

if you do this it will be all from yesterday

=dcount("IDNO","tblprob",[date]= #1/5/2001#")
a date in a textbox
=dcount("IDNO","tblprob",[date]= #" & me.text1 & "#")

all the above is based on me assuming the fieldname in tblprob that tracks the date of the call is named date.

if this is correct I want to advise you against using date as a field name as date is a reserved work in access and can run into problems. we get around it by using brackets to let access know you are refering to a field


 
you might also want to consider this after activating the button instead.

Me.yourTextboxname = Me.RecordsetClone.RecordCount
 
ok if I do as you say in the first instance my error is "the expression you entered has an invalid date value"

I can as you say put in a date in the second instance - altho I still get a 0 value.

But I dont want to specify a date in my code because I already have the parameter query for that choice.

so if like today I press button - it asks for my date - which I key in - in the top box I want it to show "10" as I have had 10 calls and details of those calls show below this.

I do take note of your comment regarding the date tho.

cheers
 
If you run the query with a specific date rather than as a parameter are you getting a count?
Because all I can think of if you are getting a 0 count value is that your query isn't recognising a date value in the qeuried table,maybe???
It could be just the date format of the field or you might have to specify the field as a date type.
Have a look see it could be that simple.

Rob
 
thank you guys for your help

It seems because I dont show my date field I was having problems with it accepting the date formats and I didnt want to specify any date because of the parameter choice.

So I went to

=Count([IDNO])

which gave me the result I wanted.

so thanks for your help all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top