psueoc
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_To tals_By_Da te]
@ActualCostDate = '3/2/2011 12:00:00 AM'
SELECT 'Return Value' = @return_value
GO
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_To
@ActualCostDate = '3/2/2011 12:00:00 AM'
SELECT 'Return Value' = @return_value
GO
'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
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
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.
?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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
?ParamSPT2("2011-07-01")
2011-07-01
2011-07-01
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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_To tals_By_Da te] 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_To tals_By_Da te]
@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
USE [PSEOC IBIX Import]
GO
/****** Object: StoredProcedure [dbo].[Get_IBIX_Success_To
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_To
@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
from IBIX_Import_Batch
where ActualCostDate = @ActualCostDate
END
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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