473,889 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

item cannot be found in collection corresponding to the requested name or ordinal

9 New Member
I am seeking help to try and fix an error that I am getting inside of my excel vba code. I am trying to import the column names of a sql table into an excel worksheet. When I run this code:

[For intCount = 0 To rsmyf.Fields.Co unt
Range("A2").Off set(intCount, 0).Value = rsmyf(intCount) .Name]

I get this error: Run-time error '3265'- Item cannot be found in the collection corresponding to the requested name or ordinal. The error appears here - ".Name"

Can someone tell me what I need to do to fix this?
Nov 21 '11
14 13865
dsal3
9 New Member
Can you tell me what the syntax should be for both?
Nov 22 '11 #11
dsal3
9 New Member
I changed my syntax to query the system table.

strSQL = "Select column_name from information_sch ema.columns where table_name='Tes ttbl'"

This returns all of the column names, however, I am still getting this error: item cannot be found in collection corresponding to the requested name or ordinal. Can someone please help me fix this error? The code is erroring out on this ' = rsmyf.Fields(in tCount)'


[For intCount = 0 To rsmyf.Fields.Co unt
Range("A2").Off set(intCount, 0).Value = rsmyf.Fields(in tCount)
Next]
Nov 22 '11 #12
Rabbit
12,516 Recognized Expert Moderator MVP
If you're querying the system table, you no longer want to return the fields of the recordset. Instead, you have to iterate through the rows of the recordset.
Nov 22 '11 #13
dsal3
9 New Member
Can you tell me how that can be done in my code?
Nov 22 '11 #14
Rabbit
12,516 Recognized Expert Moderator MVP
I don't know VB 4/5/6 so I can only give you pseudocode. You'll have to port it appropriately.
Expand|Select|Wrap|Line Numbers
  1. recordset.MoveFirst
  2. Do While Not recordset.EOF
  3.   something = recordset(1)
  4.   recordset.MoveNext
  5. Loop
Nov 22 '11 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

4
10317
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I get a servlet error "cannot find collection". Not usre if my issue is HTML, JSP, WebSphere or ??? Any help is very much appreciated. HTML file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
5
9404
by: J. Muenchbourg | last post by:
The field name 'articleid', which is an identity/primary key , is not being recognized in my recordset as I get an " Item cannot be found in the collection corresponding to the requested name or ordinal" error with the following- the line number that the error message points to is on my response.write for the rsid("articleID") : dim sqlid,rsid sqlid = "SELECT max(ArticleID) from tblarticles"
2
22836
by: CJM | last post by:
I'm running a stored procedure that inserts a record into a table then returns the Identity field value. I've done this kind of thing plenty of times in the past, but I'm obviously doing something wrong this time.. I've tested the Stored Proc in QA and it works fine. The SQL code runs OK in ASP (iAffected = 1 which shows the record is inserted), but when I try to query the resulting recordset, I get an error: "Item cannot be found in...
2
3992
by: RBohannon | last post by:
I had some help on this one earlier, but I'm still having a bit of trouble. I'm sure it's something simple that I just don't know. I'm using Access2000. I have one table with employee salary information. I need to calculate the bi-weekly gross pay (BWG) for each employee. The BWG is slightly different for leap years. As the BWG will have to be adjusted at the beginning and end of every leap year, I want to be able to update all...
1
3186
by: grgimpy | last post by:
This code is supposed to take the last three records entered into the query "Ni-Au-CooperSubformQuery" and place them in the table MyTable. After placing the three records in the table it should analyze them. For some reason I am getting the "item not found in collection" error when I execute this code. It pertains to my line: If rstSPC. > SPCAve + 2 * SPCSigma Then TwoOfThreeP = TwoOfThreeP + 1 For some reason the field is not...
2
1717
by: indhu | last post by:
Hi its not working, i want only distinct record. here its repeated records coming. accdb = "SELECT DISTINCT sequence FROM scene WHERE sceneid = '" & myquery & "' " and when i select the first record in combo it says run time error: item cannot be found in teh collection corresponding to the requested name or ordinal. but not for second records
2
2000
by: meyousikmann | last post by:
This will be difficult to explain so bear with me. If anyone is familiar with Tibco Rendezvous and/or Microsoft Messaging, this may make more sense. I've created a hierarchy of objects that looks something like this: Tibco-->Transports-->Transport Where Tibco is the overall component that owns a collection of Transports and each Transport is an object of a class.
3
30537
by: martin | last post by:
Hello, Could someone here please explain the reason for the error in the subject (the full error below) I dont get this everytime and i've never gotten while debugging. The code (also below) which causes this is part of an ftp application (the guts of which i got from some shared code) that is scheduled to execute nightly. Sometimes it will run for a few nights in a row without any problems other times it just fails with that error....
2
4271
by: Sticksboy | last post by:
I keep getting this error message - Item cant be found in the collection corresponding to the requested name or ordinal I dont understand what it means to be honest. I am trying to get the code I have written to fill the textboxes on the form, I have been using Me.Controls on another form and this works fine, but with me doing slightly different in the way the form opens it doesnt seem to like it. Can anyone point out where I have gone...
8
6311
by: charli | last post by:
Error 3265, "Item cannot be found in the collection corresponding to the requested name or ordinal" code programatically opens a query using ADOX and changed the sql Dim cat As New ADOX.Catalog Dim cmd As New ADODB.Command cat.ActiveConnection = CurrentProject.Connection Set cmd = cat.Procedures("qryLostCostCodes").Command 'opens existing query to edit
0
9967
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9810
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10443
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9611
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7151
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6029
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4650
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.