Link to home
Start Free TrialLog in
Avatar of psueoc
psueocFlag for United States of America

asked on

VBA Error 3265 Item not found in this collection.

I have a stored procedure that requires a date parameter.  It is called from from within an access function.  The results from the Immediate window return:
VBA Error
 3265
Item not found in this collection.

I am assuming that means there are no records found.  In order to eliminate complexities, I have tested the stored procedure form the SQL Server query editor and I am unsure what the correct date format required.  Here is the stored procedure or the editor that I am executing from:

USE [PSEOC IBIX Import]
GO

DECLARE      @return_value int

EXEC      @return_value = [dbo].[Get_IBIX_Success_Totals_By_Date]
            @ActualCostDate = '3/2/2011 12:00:00 AM'

SELECT      'Return Value' = @return_value

GO
Avatar of TMWSIY
TMWSIY

'Item not found in this collection' generally means the the field name you are referencing in you SQL statement doesn't exist in the table. Check to make sure you spelled the field name correctly.

double check the variable you're passing in from access

if you're passing "2011-1-1", it needs to be wrapped in single quotes to pass it as a string/date rather than an integer
Avatar of psueoc

ASKER

?ParamSPT2('2011-07-01')  This states compiler expected expression

?ParamSPT2("2011-07-01")
2011-07-01
VBA Error
 3265
Item not found in this collection.


?ParamSPT2(2011-07-01)
2003
VBA Error
 3265
Item not found in this collection.
ASKER CERTIFIED SOLUTION
Avatar of derekkromm
derekkromm
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of psueoc

ASKER

?ParamSPT2("2011-07-01")
2011-07-01
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of psueoc

ASKER

This is not the output but it may help.  The output is null.


USE [PSEOC IBIX Import]
GO
/****** Object:  StoredProcedure [dbo].[Get_IBIX_Success_Totals_By_Date]    Script Date: 03/09/2011 10:17:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:            
-- Create date: 6/4/08
-- Description:      Returns success row count and cost for a given actual cost date
-- =============================================
ALTER PROCEDURE [dbo].[Get_IBIS_Success_Totals_By_Date]
      @ActualCostDate                        datetime
AS
BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;

      select sum(SuccessRowCount) as 'Rows Imported Successfully', sum(successactualcosttotal) as 'Total Actual Cost Imported Successfully'
      from IBIX_Import_Batch
      where ActualCostDate = @ActualCostDate

END



SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of psueoc

ASKER

We're close.  I am able to "pick a date from that list and try the statements at the beginning of the post w/ it ."  But when I try it in the access Immediate window I still receive:

2011-03-02
VBA Error
 3265
Item not found in this collection.

or nothing when Debug.Print MyRS!attribute_id, MyRS!attribute_name, MyRS!attribute_value is commented out.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of psueoc

ASKER

Awesome!  That works.  Thanks derekkromm for your effort with this issue!  So I should be able to hook that to an Access form, button event and return the results?
I believe so