Wrong Number of Arguments

Novice1

Registered User.
Local time
, 23:34
Joined
Mar 9, 2004
Messages
385
I'm trying to count a date field between (to include) two dates (without luck)

I tried ...

=IIf(([DiscoverDate]>=[Enter first day: DD-MMM-YR]) And ([DiscoverDate]<=[Enter last day: DD-MMM-YR]),Count([DiscoverDate]),Null)

I tried ...

=IIf([DiscoverDate] Between [Enter first day: DD-MMM-YR] And [Enter last day: DD-MMM-YR]),Count([DiscoverDate]),Null)

Any suggestions?
 
first problem is dates are a numeric datatype so you need to make your text entry the same - so you need to use #

...[DiscoverDate]>=#[Enter first day: DD-MMM-YR]#

second problem is you don't use count in that way. However can't suggest a solution because you have only provided part of the code which is ambiguous. Not sure if you are using a query, vba code or a controlsource to a control on a form or report. Please provide more detail
 
Sorry. I have a field in the report footer. I'm trying to count the number of instances between two dates based on the date range provided by the user (between [Enter first day: DD-MMM-YR]) And [Enter last day: DD-MMM-YR]
 
the two dates provided by the user need to be controls on the report or a form, you cannot 'prompt' as you are expecting as you would in a query

assuming you have two fields completed by the user called say SDate and EDate, the controlsource to the control would be something like

=sum(IIf(([DiscoverDate]>=[SDate]) And ([DiscoverDate]<=[Edate]),1,0))

however I'm not sure this will work and not in a position to test it
 

Users who are viewing this thread

Back
Top Bottom