472,371 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 software developers and data experts.

Type conversion problems with Access Import Wizard

I've been trying to use the Access Import Wizard to expedite importing data
into my mdb. The nice thing about the wizard is that I can import from
different file formats - txt, xls, even Outlook - and dump everything into a
table.

The problem is once I have the data imported into a new table, I can't do
much with it. If I try to run an Append query and insert data from the new
table into an existing table, the query fails - "Error Number 3464: Data
type mismatch in criteria expression." - because the Wizard does not have
any type info when importing form flat files.

How can I correct the datatypes? Can I run a DDL query against the new
table? Is there an easy way to identify what table has just been imported?
Or do I have to loop through the QueryDefs collection and compare to
existing tables?

Thanks in advance.
Nov 13 '05 #1
3 3554

deko wrote:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook - and dump everything into a table.

The problem is once I have the data imported into a new table, I can't do much with it. If I try to run an Append query and insert data from the new table into an existing table, the query fails - "Error Number 3464: Data type mismatch in criteria expression." - because the Wizard does not have any type info when importing form flat files.

How can I correct the datatypes? Can I run a DDL query against the new table? Is there an easy way to identify what table has just been imported? Or do I have to loop through the QueryDefs collection and compare to
existing tables?

Thanks in advance.


What if you create a few import specs and then use those to import your
data? I think they're listed as IMEX in the system objects table.
then you could just create a simple form that does most of the work for
you and reuses the specs you've created. Any particular reason you
need all the data in separate tables?

Nov 13 '05 #2
> What if you create a few import specs and then use those to import your
data? I think they're listed as IMEX in the system objects table.
then you could just create a simple form that does most of the work for
you and reuses the specs you've created.
Well, yes, If I import a text file I can click the Advanced button in the
Import Text Wizard dialog to define and save import specs. Thanks for
pointing this out (I didn't realize I could do that). But the problem is
mainly with Excel spreadsheets. AFAIK, there is no way to define import
specs for Excel (using the Import Spreadsheet Wizard).

The Excel files in question are actually built from text files. But the
text files vary in format and need massaging into Excel before they can be
imported. So the spreadsheets are in good shape and have the proper field
names as header rows. It's just the data types that's the problem. One
possible solution might be to Link to the file (rather than Import), then
run an Insert query to dump everything from the linked table into an Access
table. This seems to convert the data types as needed.
Any particular reason you need all the data in separate tables?


Because the tables are normalized, it's a challenge to import data. The
Entity_ID (Autonumber pk) must first be created in the main table, then
stuff like Address, Phone Number and Transactions can be inserted in their
corresponding tables with the Entity_ID as a fk. But the flat file with the
data to be imported has everything in one row - Entity, Address,
Transaction, etc. - so I create a recordset from the imported file and
insert one record at a time saving the MAX(Entity_ID) back to the imported
table after each insert so additional queries can be run against it to
populate the other tables. So if I have a comma delimited text file I could
set up some import specs, but with an Excel spreadsheet I have type
conversion problems.
Nov 13 '05 #3
> Generally, if you use code, rather then "wizard generated" imports,
you won't even need Excel or human intervention to import the file.
This method is also generally a lot faster and produces more
consistent results, however it can take a few days to set up properly
and requires that the files are somehow or another "detectable" to the
changes in format and "style". I can't think of a time when that
hasn't been possible in the past could of decades I've been doing
that.
It would take some serious regex and text processing get any kind of
consistency in these files. With an Excel template, it's not too difficult
to get the data into Excel. It would be nice to just suck it in from raw
text, but for the frequency this stuff comes along the extra step is
tolerable for now.
Stop thinking in terms of how you can use "Wizard Generated" code to
do things. Think in terms of "How I would do this if I was typing in
things", and duplicate *that* in VBA code.


Yeah, sometimes it is easier to just code it, but I'll take whatever Access
gives me for free. From what I've seen so far, the Import Wizard might be
helpful if you have text files in a consistent format and can use Import
Specs, otherwise not good for much.
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: RWC | last post by:
Hello, I'm having trouble converting code in Access XP / 2002. I have some code that declares an variable "as database" in Access 97, which is not recognized in Access XP. I've tried to find a...
2
by: Maurice | last post by:
Folks once again I look forward to your invaluable assistance. When converting an Access 2002 mdb back to Access 1997 using the Access 2002 inbuilt tools I receive the following error message...
4
by: Matt Sawyer | last post by:
I am attempting to use an API (CxApiOem.dll) that has a large number of defines and complicated structs. It's just too much hassle to attempt to use DLLImport to make the desired API calls. ...
1
by: bala | last post by:
Hi Access Gurus The MS Access DB (MS Access 2002 Database) which is currently serving as the backend Database to MS Access (MS Access 2002/XP) frontend needs to be converted to Oracle 8i Backend...
2
by: jason.teen | last post by:
Hi, I am having trouble importing a spreadsheet from Excel into an Access Database. I have noticed that even specifying the Cell Type of the Excel Data Cell, When I import it, still get...
16
by: thefritz_j | last post by:
We just converted our VS2003 1.1 VB web project (which was working fine) to VS2005 2.0 and now I get: Parser Error Message: Could not load type '<Namespace>.'. Source Error: Line 1: <%@...
4
by: Mark | last post by:
Bad header on my first post. Sorry. When I import a file using the Import Spreadsheet Wizard and I get to the Field Options screen where it allows me to choose the fields and the Indexed...
6
isben22
by: isben22 | last post by:
I am a beginning developer using ACCESS 03 and Share Point Portal 2003. I have a list of events with start and stop dates in SharePoint that I want to pass to and Access Data Base. Ultimatly I...
6
by: teser3 | last post by:
I am trying to import an Excel 2003 sheet into my Access 2003 database. I get error message saying sheet could not be imported and it referred me to an Import error table which showed type...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.