Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Imported Field Names < Employee Training 6 | Highlight Birth Month >
Imported Field Names
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   13 months ago

Beware Bad Excel Field Names in Access Imports


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Join Now

In this Microsoft Access tutorial, I will show you how to troubleshoot common errors when importing data from Excel, focusing on issues caused by bad field names like trailing spaces. We'll explore how to address error 3265 and ensure successful data imports using VBA with practical solutions and examples.

Brent from Midwest City (a Gold) asks: I am trying to import another spreadsheet, but I am getting error 3265: "Item not found in this collection." I used the Immediate Window to check if the field is in the collection, and it is. Please see the screenshot. What am I missing?

Members

There is no extended cut, but here is the database download:

Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the files from class plus get access to the Code Vault. If you're not a member, Join Today!

Prerequisites

Recommended Courses

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Diamond Sponsors - Information on our Sponsors
Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted
Merch Store - Get your swag here!

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

KeywordsImported Field Names in Microsoft Access

TechHelp Access, importing from Excel, field name troubleshooting, Access field name rules, handling bad field names, VBA transfer spreadsheet, debugging import errors, resolving collection errors, Access field name correction, tabledef field rename, error 3265, trailing space issue, immediate window check, item not found in this collection

 

 

 

Comments for Imported Field Names
 
Age Subject From
13 monthsDon't Forget About Those Pesky TabsLyle Bailey
13 monthsNotes to Access TeamSami Shamma
13 monthsSami add to the long listJuan Rivera
13 monthsInteresting Side NoteRichard Rost

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Imported Field Names
Get notifications when this page is updated
 
Transcript Welcome to another TechHelp video brought to you by AccessLearningZone.com. I'm your instructor Richard Rost. Today, we're going to talk about importing field names when you import data from either Excel or a Text file or any other kind of format. Sometimes you get some field names that aren't great, and it might cause a problem that we'll see in just a minute.

Today's question comes from Brent in Midwest City, Oklahoma, one of my gold members. Brent says, "I'm trying to import another spreadsheet, but I'm getting an error 3265 item not found in this collection. I use the immediate window to check to see if the field is in the collection, and it is. Please see the screenshot. What am I missing?" All right, let's see this in the forum thread on my website.

All right, so here we are on my website, and in fact, this question that Brent asked a couple weeks ago was a previous TechHelp video. But we're continuing it down below. Where are we down here? This is where he asked the question now. Please see the screenshot. What am I missing? Here's a screenshot.

Right here, all right, we've got our s revenue. That's the line that's giving him the problem, and here's his list of fields down here, and there's a revenue right there. So it looks like it's in the table. Now usually that's a spelling error or the field doesn't exist in the table, but he's sure that it's in there, and it looks like it's spelled correctly.

So I said, let's see the table design, and there's the table design. Now I can see there's all kinds of fields in here that violate my rules for naming fields. Right, no spaces anywhere, no non-standard characters, right like these. But sometimes when you're dealing with a spreadsheet or a file that someone else gives you, you really can't deal with that. You really, you know, you got no choice but to deal with what they give you.

Now Kevin, yet one of our longtime contributors, came up and said, "See if there's a trailing space after revenue or any of the other field names." Okay, and that's actually genius because, and I told him, that's a good catch because when you make a field in Access in a table, it doesn't let you put a trailing space on the field name. But if you're importing from something else, you can get it will cause that space to be on the end, which could cause this problem that is being experienced. Let me walk you through it and show you how this happens.

So here I am in the TechHelp free template. This is a free database you can grab up on my website if you want to. And if I go into any one of these fields or tables and I try to come in here like contact date and put a space at the end of it, okay, if I move off of it and come back to it, look at that, it doesn't let you do it. Okay, that's one of the safeguards in Access's table design.

But if I make a spreadsheet, let's create a blank workbook, and let's say I've got first name and I've got last name, but someone who ever made this spreadsheet accidentally put a space there. So last name has a space after it. Okay, let me add phone number. Okay, and I'll just put a couple of people in here. Let's do Rick Ross, whatever, right, and Joe Smith. Okay, save this, we'll call this import test.

And now I'm gonna go back over to Access and import that using VBA using transfer spreadsheet. Interestingly enough, if you do external data and then import it manually from here, Access will remove that trailing space. I just tried it. All right, it's only the VBA method that causes the problem.

All right, so let's go into our VBA here. I'm just hijack this button and right here, we'll say do command dot transfer spreadsheet. We're going to do an import, comma, just comma again for the version. The table name will call it my import T. The file name, let me go grab the file name. All right, there's the file name on my system G my drive spreadsheets import test and we'll say has field names is true or any use their field names all right the other options we have to worry about. And then a people were done all right save that.

And of course, debug compile once in a while close that and now let's go ahead and run it. Okay, there's my import table. All right, let's take a look at design view. First name last name look at that there's a space there. See an Access won't truncate it like it normally does that space is there. Okay, so now if I try to do something else, you know use a record set or whatever. Let's just write a simple one real quick dim rs as a record set. Set rs equals current the b dot open record set import T. While not rs a o f do some stuff rs dot move next when and then set rs equals nothing. That's my basic shell of a record set right now in here. I'm going to say message box rs last name.

Okay, save that and now BAM there's your error item not found in this collection. Okay, now how do you fix that since you have to deal with their field names. Well in this particular case now that you've recognized as a space there you can do this put the space in your code. That should work. Let's see let's make sure. Let's make sure it works before I tell you. Okay, there we go. There's rost smith and whatever. Okay, if you don't like writing it like that you could also write it like this and you don't need the brackets you can write it like that. That's two. Now there's two ways to write those fields there.

Okay, so that's just something that now that you know that that's now you could go to the original person who made this and say hey fix your field names right you could change them after importing them if you want to. You know you could use a table death and you could loop through the field names in here and correct them. That's definitely something I cover that in my developer class. That's a lot more advanced. You can use recordsets or even SQL to modify the structure of a table. But this is the easiest solution considering you're given a file that you have to work with however they give it to you. Okay, if you're not allowed to change the original sheet I would go change the sheet. That's the easiest thing. But that's it nice quick short one for today.

For those of you who are wondering I'm in the middle of the employee training series I just posted video six yesterday. I prepared a bunch of those before I went on vacation almost two weeks ago. And I figured I plan on finishing it when I get back. But I still got to record seven eight nine and so on so I do got more lessons for that one coming. Probably tomorrow, but I wanted to get a quick video out there for today for you guys because I don't want you to miss me if I don't post a video when I'm supposed to post a video.

All right, anyways, Brad I hope that helps you out. Kevin yep, thank you very much for the suggestion. I don't know if I had a thought about that. That's one of those situations where for me, you know looking at a screenshot like that you can't really easily see that right. Having a copy of the database to work with makes it a lot easier. But help trying to help someone remotely even seeing a screenshot sometimes you don't think of things like that. But Kevin Kevin nailed it.

So that's gonna do it. There's a TechHelp video for today. Hope you learned something. Live long and prosper my friends. I'll see you next time.

TOPICS:
Importing field names from Excel or Text files
Error 3265: Item not found in collection
Use of the Immediate Window to check fields
Table design and field naming conventions
Trailing spaces in field names
Access restrictions on trailing spaces
Difference between manual and VBA import
TransferSpreadsheet method in VBA
Debug and compile VBA code
Using recordsets to access table data
Handling errors with incorrect field names
Suggestions for fixing field names after import

COMMERCIAL:
In today's video, we're continuing with field name issues when importing data from Excel or text files. You'll learn how to troubleshoot error 3265 and discover the common culprit: trailing spaces in field names. I'll demonstrate how Access handles these spaces differently depending on whether you're importing manually or using VBA. We'll explore workarounds for handling problematic field names, such as adjusting code to accommodate spaces, and discuss options like using recordsets or SQL to modify table structures. Join us and ensure your imports are error-free. You'll find the complete video on my YouTube channel and on my website at the link shown. Live long and prosper my friends.
Quiz Q1. What error did Brent encounter when trying to import a spreadsheet into Access?
A. Error 3265 item not found in this collection
B. Error 1234 field conflict
C. Error 404 data not found
D. Error 500 server error

Q2. What was suggested as a possible cause of Brent's import error?
A. Missing Excel add-in
B. Incorrect file format
C. Trailing space in the field name
D. Duplicated field name

Q3. How did Kevin suggest resolving the import error due to field names?
A. Convert the spreadsheet to CSV format
B. Check for a trailing space after field names
C. Use macros to automate the import process
D. Disable data validation in Access

Q4. Which method was causing the trailing space issue when importing data?
A. Manual import via Access's external data interface
B. VBA method using transfer spreadsheet
C. Direct entry into SQL queries
D. Using Access's linked table manager

Q5. What does Access typically do to field names with trailing spaces during manual imports?
A. Keeps the spaces intact
B. Removes the trailing spaces
C. Converts them to underscores
D. Replaces spaces with hyphens

Q6. How can the issue of trailing spaces in field names be resolved without directly editing the spreadsheet?
A. Modify the field names in the Excel file manually
B. Adjust field names in Access after importing using brackets or code adjustments
C. Use Access's error correction wizard
D. Restart the computer and try again

Q7. What advanced method can be used to correct field names after importing data into Access?
A. Data Macro Automation
B. TableDef in VBA to loop through and correct field names
C. SQL Performance Tuning
D. Access Error Log Analysis

Q8. What was Richard's recommendation if you're allowed to change the original Excel sheet?
A. Add new fields to the spreadsheet
B. Use text files for importing instead
C. Fix the field names directly in Excel
D. Create a backup before importing

Q9. Which of the following is NOT a rule for naming fields according to Richard?
A. No spaces
B. No non-standard characters
C. No duplicate names
D. No special characters like underscores

Q10. What was the purpose of Richard's video?
A. To introduce a new Excel feature
B. To offer a complete VBA course
C. To help users with importing data and resolving common related issues
D. To discuss the latest updates in Microsoft Access

Answers: 1-A; 2-C; 3-B; 4-B; 5-B; 6-B; 7-B; 8-C; 9-D; 10-C.

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
Summary Today's TechHelp tutorial from Access Learning Zone is all about managing field names when importing data into Microsoft Access from Excel or a text file. I am your instructor, Richard Rost. Often, the field names in imported data can cause issues, such as errors indicating that an item is not found in a collection. Today, we'll discuss how to handle these situations.

A member recently encountered error 3265 while importing a spreadsheet, where Access couldn't find a specific field in the collection despite its apparent presence. After some troubleshooting, it was apparent that a common cause for such issues is incorrect naming conventions in field names. This includes having spaces or non-standard characters in the field names.

In the field's design view, Access usually prevents having trailing spaces in field names. However, if you import data from an external source, such as a spreadsheet, trailing spaces might still accompany field names, leading to errors. Someone else might have originally created the spreadsheet or file, and you might not have the luxury of correcting field names manually.

A brilliant suggestion from one of our contributors was to look for a trailing space after the field name. Indeed, when you import data using Visual Basic for Applications (VBA) and the TransferSpreadsheet method, Access may retain these trailing spaces. This doesn't occur if you import manually via the Access interface, which trims such spaces automatically.

To illustrate, let's say you have a spreadsheet with fields for first name, last name, and phone number. Suppose there's an inadvertent space after the "last name" field. If you import this using VBA, Access keeps the trailing space. When trying to access the field in a VBA recordset, the trailing space causes an error.

To resolve this, you can account for the space within your code by including it in the field name reference. Alternatively, once imported, you can adjust the field names using VBA to remove trailing spaces or correctly match them as needed. This can be achieved by examining the field names and modifying them through VBA programming, which is covered more extensively in my developer classes.

If it's possible to do so, the simplest fix is to modify the original spreadsheet field names before importing. However, when constraints exist, ensure your code accounts for any discrepancies.

A quick note for those following the employee training series: I've recently updated it, and more lessons are on the way. I expected to finish recording the upcoming sessions soon.

I hope this tutorial helps address similar issues you may encounter. For a complete video tutorial with step-by-step instructions on everything discussed here, visit my website. Live long and prosper, my friends.
Topic List Importing field names from Excel or Text files
Error 3265: Item not found in collection
Use of the Immediate Window to check fields
Table design and field naming conventions
Trailing spaces in field names
Access restrictions on trailing spaces
Difference between manual and VBA import
TransferSpreadsheet method in VBA
Debug and compile VBA code
Using recordsets to access table data
Handling errors with incorrect field names
Suggestions for fixing field names after import
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 12/11/2025 8:10:49 PM. PLT: 1s
Keywords: TechHelp Access, importing from Excel, field name troubleshooting, Access field name rules, handling bad field names, VBA transfer spreadsheet, debugging import errors, resolving collection errors, Access field name correction, tabledef field rename, erro  PermaLink  Imported Field Names in Microsoft Access