473,493 Members | 4,319 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can't see some data in VBA recordset

2 New Member
I have a query with data from several tables. I open it as a recordset in a VBA module and can get data from some of the fields with eg SomeData = TheQuery!SomeField but for other fields when the code runs I get error 3626 - item not found in this collection.

It is not a typo - the field names are correct.

Any hints?

Is there a way to see what it thinks is in the collection?

Thanks
Mar 11 '08 #1
2 1475
Stewart Ross
2,545 Recognized Expert Moderator Specialist
I have a query with data from several tables. I open it as a recordset in a VBA module and can get data from some of the fields with eg SomeData = TheQuery!SomeField but for other fields when the code runs I get error 3626 - item not found in this collection.
...
Hi. This message just means that the field name you've used is not recognised as belonging to any field in that particular recordset.

To show all field names for a recordset in the immediate window run the following segment of debug code in one of your recordset procedures:
Expand|Select|Wrap|Line Numbers
  1. Dim FieldCounter as Integer
  2. For FieldCounter = 0 to [name of recordset].fields.count - 1
  3.     Debug.Print [name of recordset].fields(FieldCounter).Name
  4. Next I
-Stewart
Mar 11 '08 #2
AustinK
2 New Member
Thanks - that helped me to find the problem. It only listed 3 fields instead of the expected 15-odd. Working back I found I had opened a different recordset with the same name.

My VBA is very rusty.

AK
Mar 11 '08 #3

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

Similar topics

3
2057
by: Ryan Ritten | last post by:
Hey, I just started working at this new company and they gave me a simple database project to start with. yet I am starting to look like an idiot cause I can't even seem to connect to the MS...
3
6634
by: Richard Hollenbeck | last post by:
I have the following query in my form's code: Private Function Get_Data(fieldNum As Integer) Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset strSQL = "SELECT & "", "" & ...
7
1589
by: Matt | last post by:
Is there a way to put my class vals to arrays ! RecordSet Track1 = new RecordSet("It aint fear",1); RecordSet Track2 = new RecordSet("Gotta go",2); RecordSet Track3 = new RecordSet("My life",3);...
1
1531
by: Noozer | last post by:
This seem to be a simple question, but I'm having no luck with Google keywords... I have an some ASP in which I open a recordset via a connection to a MSSQL database. I don't want to keep the...
52
6268
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
2
9368
by: 111mike | last post by:
Hello, Here's my problem. I cannot connect to mysql database using odbc string connections or dns. I keep getting a "cannot connect to mysql server localhost." I'm running windows XP Pro and...
12
10547
by: Matt.W.Stephens | last post by:
Here is the scenario. We have a database with patient case information. This database was previously solely used in Access. The problem is our users connect to this database (located in California)...
1
1947
by: terryspanky | last post by:
----------------------Below are all the codes don't have errors---- The only problem I have is when I Delete, I'ts not deleting the subject that I click. I want to use the above codes to modify the...
4
12411
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
7118
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,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7364
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...
0
5452
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,...
0
4579
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
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 ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.