Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBA Error  3265  Item not found in this collection.

Posted on 2011-03-09
12
Medium Priority
?
1,224 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:psueoc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 6

Expert Comment

by:TMWSIY
ID: 35083147
'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.

0
 
LVL 15

Expert Comment

by:derekkromm
ID: 35083149
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
0
 

Author Comment

by:psueoc
ID: 35083290
?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.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 15

Accepted Solution

by:
derekkromm earned 2000 total points
ID: 35083373
can you try it w/ this line commented out, to verify which line of code is causing the error?

 Debug.Print MyRS!attribute_id, MyRS!attribute_name, MyRS!attribute_value
0
 

Author Comment

by:psueoc
ID: 35083446
?ParamSPT2("2011-07-01")
2011-07-01
0
 
LVL 15

Assisted Solution

by:derekkromm
derekkromm earned 2000 total points
ID: 35083498
so no error?

it appears it is unable to find at least one of those field names in the recordset (attribute_id, attribute_name, attribute_value)

can you show a sample output of the stored procedure execution from sql server?
0
 

Author Comment

by:psueoc
ID: 35083790
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



0
 
LVL 15

Assisted Solution

by:derekkromm
derekkromm earned 2000 total points
ID: 35083858
first, this:

Debug.Print MyRS!attribute_id, MyRS!attribute_name, MyRS!attribute_value

Open in new window


is going to fail because there aren't any attributes returned that have those names. you need to just remove that (part of a previous program/test?) or change it to the actual attributes

second, if you run this in query analyzer:

[dbo].[Get_IBIS_Success_Totals_By_Date] '2011-01-01'

Open in new window


do you get a row back? and if so, does it work for that date in your code?

if not, does this work:
select sum(SuccessRowCount) as 'Rows Imported Successfully', sum(successactualcosttotal) as 'Total Actual Cost Imported Successfully' 
      from IBIX_Import_Batch 
      where ActualCostDate = '2011-01-01'

Open in new window


if still nulls, it probably means that date isn't in the table. find a date that works using:

select distinct ActualCostDate from IBIX_Import_Batch order by ActualCostDate

Open in new window


pick a date from that list and try the statements at the beginning of the post w/ it
0
 

Author Comment

by:psueoc
ID: 35084654
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.
0
 
LVL 15

Assisted Solution

by:derekkromm
derekkromm earned 2000 total points
ID: 35084702
replace that debug.print with this:

Debug.Print MyRS![Rows Imported Successfully], MyRS![Total Actual Cost Imported Successfully]

Open in new window


0
 

Author Comment

by:psueoc
ID: 35084776
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?
0
 
LVL 15

Expert Comment

by:derekkromm
ID: 35084799
I believe so
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question