>John,
>I am getting a runtime error 3265 Item not found in the collection.
That's not much use unless you also say which line of code is triggering
the error and what values the relevant variables have at that point. But
it probably means that one or more of the parameter names is different
from what you think. You say the names are
Open
Closed
StartDate
EndDate
but if you open the query in design view are they
[Open]
[Closed]
etc. or
[Forms]![frmCIOC]![Open]
etc.? The parameter names you use in your code must match whatever you
have used in the query (or the query must match the names in the code).
>Parameters for query:
>[Forms]![frmCIOC]![Open]
This expression seems wrong to me:
>[Forms]![frmCIOC]![Closed] >=[Forms]![frmCIOC]![StartDate] And
><=[Forms]![frmCIOC]![EndDate]
It looks as if it should be more like
([...]![Closed] >= [...]![StartDate]) _
And ([...]![Closed] <= [...]![EndDate])
>Revised code
>Private Sub cmdStatus_Click()
[quoted text clipped - 16 lines]
>With qdf
> .Parameters("Open").Value = Forms("frmCIOC").Controls("Open").Value
This statement looks really confused. I'm surprised it compiles and
suspect that whatever it does it's not what you expect.
> .Parameters("Closed").Value = Forms("frmCIOC").Controls("Closed").Value
>And .Parameters("StartDate").Value =
[quoted text clipped - 9 lines]
>With rst
>intMaxCol = rst.Fields.Count
As far as I know you don't need to define a range that matches the
dimensions of the recordset, but can just specify one cell.
CopyFromRecordset then pastes the data into the sheet starting at that
cell.
> If rst.RecordCount > 0 Then
> rst.MoveLast: rst.MoveFirst
[quoted text clipped - 140 lines]
>>
>> Please respond in the newgroup and not by email.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
CyndyG - 16 Sep 2005 18:27 GMT
Thank You.
> >John,
> >I am getting a runtime error 3265 Item not found in the collection.
[quoted text clipped - 216 lines]
>
> Please respond in the newgroup and not by email.