473,386 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

no warnings when using transferspreadsheet or text

3
I am using transfertext and transferspreadsheet in VBA to import an excel file (.csv or .xls) into access 2003.

Some of the fields are failing (I am getting an import error file), but I am not getting any warning message. I have explicitly turned on the warnings, but it didn't make a difference. If I manually import the table, the warnings appear ("Microsoft Access was unable to append all the data to the table. The contents of fields in X record(s) were deleted, and Y record(s) were lost due to key violations . . . ")

Does anyone have any ideas how to get these warnings to appear?

Note that the file (stSave) is importing, with the exception of a few fields.

Here is my code:
Expand|Select|Wrap|Line Numbers
  1.      DoCmd.SetWarnings True
  2.  
  3.     If Right(importFile, 4) = ".xls" Then
  4.         DoCmd.TransferSpreadsheet acImport, , tblName, stSave, True
  5.     Else
  6.         DoCmd.TransferText acImportDelim, , tblName, stSave, True
  7.     End If
  8.  
Thank you.
Dec 15 '08 #1
4 3850
nico5038
3,080 Expert 2GB
In general this is cause by two main "problems"
1) The data type of the column is set automatically, but Access uses just some 8 rows. So a "change" further down causes a date or number to fail :-(
Solution:
Repeat the first line with the column names. This forces Access to import everything as text and (after deleting the first row) you can set the data type properly.
2) There are fields "mandatory" containing no data. Set the fields of a table to accept Null values by allowing zero length.

Nic;o)
Dec 16 '08 #2
ambmil
3
This process will be used by many people, and the intention is that there not be any manipulation of the excel file (which comes from a third party). So, manually adding another row is out.

I am importing into a pre-existing table, so the field types are certainly preset.

Again, if I bring in the file manually to the existing table (Tables -> new -> import -> existing table), the warnings DO appear.

None of the fields that are failing are mandatory, they all allow zero length fields.

Any other ideas?
Dec 16 '08 #3
nico5038
3,080 Expert 2GB
Try to create a new table linked to the excel sheet.
Then use an Append query to load the data.

Nic;o)
Dec 16 '08 #4
NeoPa
32,556 Expert Mod 16PB
Always use SpecificationName where possible. This stops Access from trying to determine the type of the field from the data.

When doing a transfer manually, you can go into advanced mode, where you can load and save Import/Export Specifications.

Welcome to Bytes!
Dec 21 '08 #5

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

Similar topics

0
by: Dave Hammond | last post by:
When using mysqlimport, the final statistics include a count of "Warnings", for example: Connecting to foo.whatever.com Selecting database foo Loading data from LOCAL file: foo_userInfo.imp...
1
by: Nathan Bloom | last post by:
Hi, I have a procedure that transfer data from an Excel spreadsheet to an Access 2000 table. There is a start date and an end date in the range specified. One of the date fields transfers...
1
by: Bob Hynes | last post by:
Hi All, In Access97 I'm using a TransferSpreadsheet acExport in vba code and it errors when the spreadsheet I'm exporting does not exist. If I create a empty spreadsheet with the name I use in the...
1
by: barma16 | last post by:
I've hit a bit of a brick wall here, and could use some advice. I have an Access application whose output is a four-tab Excel spreadsheet where three of the four tabs are the result of database...
2
by: deko | last post by:
I use a complied query to export to Excel like this: SELECT * INTO . FROM tblExcelData; But I have a situation where I need to export several tables into the same worksheet. The idea is to...
2
by: Hank | last post by:
Hello, I use TransferSpreadsheet on a daily basis using a Table as a datasource. I was under the impression from reading Help that you could also use a Query as the datasource. This is my code:...
30
by: prasanna | last post by:
i will be very thankful if you sent all the errors and warnings regarding to the language C thank you
1
by: superprad | last post by:
Hi I am trying to write a python wrapper for a C code I have using swig. when i try to compile the wrap.c i get a bunch of these warnings and errors can anyone help $swig -python test_hk.c this...
3
by: tony | last post by:
Hello!! I use VS 2003 and C# for all class library except MeltPracCommon.dll which is C++.NET The problem is that I get these warnings when building the exe file and use my class libraries....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.