runtime error 3265 item not found in this collection

G

Guest

In a make query there are 2 concatenated fields that end up as text fields in
a Excel report output which are the maximum and minimum of a set of cells.
We just need the fields the max and minimun fields not the concatenated
fields. So I added the fields to a table and hopefully to all the related
queries.

Then in trying to output it to Excel I added
..cells(lrow,28)= rsData!minticketprice
..cells(lrow,29)=rsData!maxticketprice
..cells(lrow,30)=rsData!minpromoprice
..cells(lrow,31)=rsData!maxpromoprice
the rsData is recordset data
the lrow is just a counter as it loops through

I am wondering why does it not think it is in the collection?
Does that mean I missed adding the fields to a query or table somewhere?

thanks,
 
J

John Nurick

Hi Janis,

Most likely you've haven't added the new fields to a query somewhere.
Start by checking the query on which rsData is based; if you can't spot
the problem, try this:

Set a breakpoint in the code on this line:
.cells(lrow,28)= rsData!minticketprice
and launch the code.

When it stops at the breakpoint, hit Ctrl-G to open the Immediate pane
and type or paste this:

For j = 0 To rsData.Fields.Count -1 : ? j, rsData.Fields(j).Name : Next

When you hit Enter, this will give you a list of the fields in the
recordset.

Then hit F8 to step through the code line by line: this will tell you
which field is missing (or the first, if there are more than one).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top