473,769 Members | 5,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in data import? It's worked using this template several times prior!

geolemon
39 New Member
Import text wizard says:
"The first row contains some data that can't be used for valid Access field names. In these cases, the wizard will automatically assign valid field names"
I'm banging my head on this one, here's why:
I've been importing files using this process and data format, with success!

I created a temporary table in Access to facilitate my import process (It's all text columns, I perform transformations later).

And I created a template in Excel to correspond to the table - essentially it's just column headers:
In Excel, I've been opening files of work that we've done for a particular customer, and rearranging the data to conform to my template. Then, each job's data is ready for import!

So in other words - the data that I started with is common format, and I'm using my "template" to create files of common format that correspond to the temp table.

And
This worked for 3 or 4 of the files. No problem.

The puzzling thing is that all of a sudden, one of my files gave me an error last night:
"The first row contains invalid data"
Or something along those lines.

So after sleeping on it, this morning I decided to try working around the issue by exporting my Excel as a tab-delimited file.

Now, the wizard is throwing the exact error message above...
...And although THIS way at least I can get through the wizard to the end and click a "Finish" button - it throws a "Property not found" error, and then "An error occurred trying to import file [my file path]. The file was not imported."
I'm very puzzled!

Particularly - how could this work for three files having exactly the same header row, and suddenly fail now?
Exported to text, and still an issue?

(worse - I need to develop this into a repeatable process to pass on to an administrative user!)
Sep 12 '08 #1
5 5895
geolemon
39 New Member
PS-
I haven't explored the "linked tables" option because it doesn't seem to be set up for the purpose of avoiding errors like these, and I'm not familiar with it. It also creates additional complexity (read: "opportunit y for error").
I'm also concerned that taking this data (currently stored discretely per-job in appropriately distinct locations) and exporting it to a common location would potentially violate something in ISO processes..
Sep 12 '08 #2
geolemon
39 New Member
"Method 'Columns' of object 'IImexGrid' failed
is the error message I originally got directly importing this one particular Excel file, followed by
The first row contains some data that can't be used for valid Access field names. In these cases, the wizard will automatically assign valid field names.
The header row is as follows:
RefID
DNP
CustPN
BOMPN
PurchasedPN
PNSource
Manufacturer
Description
Sep 12 '08 #3
geolemon
39 New Member
Eureka!!!!

I decided to just let it fly - import it into a NEW table, and I found something:

It was trying to import two extra columns (to the right of the ones I listed), and 30 or 40 extra rows of data (all blank cells, I presume from below the rows that were actually populated - although when I opened the table they appeared at the top.

I deleted the extra rows and columns, and was able to insert without problem into my "real" temp table and finish the processing routine from there.

So, the real question is this:
How does Access know what rows/columns to import?
I assumed it was just based on what was filled in, if not explicitly specified.

I don't really have a means of explicitly specifying it in this process I'm trying to develop, so it would really help to understand the logic Access uses when it isn't explicitly given.

Thanks in advance for insight!
Sep 12 '08 #4
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi geolemon. I'm glad this worked out for you in the end.

Access uses Excel's internal properties (such as the LastCell address) to determine the overall range imported, as it is the rectangular region starting at range A1 and ending at the last cell that is imported. From the last column address Access can work out what cells to read in the first row as field names.

It would appear that Access found values it could not accept beyond the columns you expected. A cell looking blank does not necessarily mean it is empty! It could contain any non-printable chracter, or spaces for instance, and you would not notice it or know it was there unless you selected the whole spreadsheet to see what the actual range was (using Crtl-End to go to the last cell).

Where the data imported has a header row it defines the field names created by Access. The ones you quote in your post are fine, and Access will normally change certain invalid characters that cannot be used in field names to ones it can accept (for instance, the period character, as in 'ABC.DEF', is I think changed to an underscore, as in 'ABC_DEF'.

Beyond that it is not really possible to speculate without seeing the sheet directly.

-Stewart
Sep 12 '08 #5
geolemon
39 New Member
So possibly there was a space or other non-visible character an those columns, somewhere?

Thinking "I need to make this a repeatable process", then you'd speculate with me that either of these precautions would work, right:

Either one:
  • Highlight "a good number" of columns to the right of "Descriptio n" and press "Delete, and highlight a "good number" of rows below my last completed row and press "Delete" - to clear alll those cell's contents
  • Highlight the range of cells I want to import, in the columns I want, "copy" and "paste" them into a new, virgin worksheet by clicking on cell A1 and doing a "paste" (or "paste values")

I've written a form for a user to browse to an Excel file, populates a text box with the path, and have an "upload" button to DoCmd.TransferS preadsheet...
I wonder if I should use the "range" variable in that command to limit the spreadsheet only to those columns? The problem that I see with that is if I state an explicit range like that, if Access will then try to import all 65536 rows?

One other annoyance is that when Access does try to import "extra" rows, it throws a primary key "duplicate records" error. Such an error would scare an end user silly - and certainly even with me, it causes me to go back to the Excel worksheet, reorder my data and perform a search for duplicate keys to make sure I don't have any! THEN I know I can ignore it, but it breaks a process that an end user would be expected to handle.
Sep 12 '08 #6

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

Similar topics

5
6244
by: Andrew Lowe | last post by:
Hi all, First off, I'm new to the Oracle world so please be gentle on me. Now down to the problem at hand. I support a CAD application that has an Oracle backend. I've been on site at my clients offices and got a dump of data, via TOAD, to bring back to my office. This has given me a file containing a large number of insert statements of the format: Insert into tgds.trip_bodies (ARRIVAL_TIME, ADJUSTED_ARRIVAL_TIME,...
67
4279
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++. That usually serves to divert the discussion from the technical subject to a discussion of the...
6
4753
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
0
2614
by: Patrick A | last post by:
All - 2 questions, the answer to either one having the possibility of making the other a moot point: 1. I have a DB with a form that serves as a GUI to let the user browse for an XML file and import it, and I can't get Access to overwrite the tables when it finds them in existence. Can anyone tell me how to make this happen? I can't get the "OtherFlags:=1" option to work -
9
2103
by: Ron | last post by:
my application is throwing an exception error when closing if I run a procedure in the app. I can't even trap the error with try/catch ex As Exception. Is there a way to completely shut down the app through code? I am using End for now. Is there a way I can suppress this exception message? The app gets invoked programmatically on a schedule. So no one would be around to click off the
6
8204
by: sara | last post by:
I have a procedure to automate bringing several Excel files into our Access tables, on a daily basis. The problem is that if the user has a problem, and tries to run the import again (maybe 3 files imported then there was a data problem and they want to re-import after fixing the problem), I can't get the Error handling to fire if the user is attempting to import duplicate key records. Message when I try to import records already on...
4
9615
by: andrewcw | last post by:
I am moving some code forward from .NET 1.1. I was able to load the XSL file and perform the transform. The MSDN documentation looks like it should be easy. But I get a compile error. Ideas ? How can I share my XSLT ( there are 2 helper stylesheets, and I check that they are also available... the loaded xsl makes reference to the helper xsl files. Where should I start looking ? // Load the stylesheet. errBefore =...
0
489
by: Alun Jones | last post by:
I'm getting the above error in a dialog box from Visual Studio 2005 when trying to sign an assembly using a PFX file, and would like to know how to resolve the problem. Background: The PFX file has been used for code-signing before (to sign an InfoPath form), so therefore the file contains a valid code-signing key. I have the correct password to the PFX file (because I get a different error
1
2951
by: hn.ft.pris | last post by:
I have the following code: Tree.h defines a simple binary search tree node structure ########## FILE Tree.h ################ #ifndef TREE_H #define TREE_H //using namespace std; template <typename Tclass Tree{ private: Tree<T*left;
0
9579
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
9416
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
10199
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
10032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8861
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
6661
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
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3948
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

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.