Importing Data From Excel Via Code Giving Unreliable Outcomes

%3CLINGO-SUB%20id%3D%22lingo-sub-2219205%22%20slang%3D%22en-US%22%3EImporting%20Data%20From%20Excel%20Via%20Code%20Giving%20Unreliable%20Outcomes%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2219205%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20had%20a%20look%20at%20several%20forum%20discussions%2C%20however%20I%20cant%20see%20a%20work%20around.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWeekly%20we%20are%20importing%20time%20cards%20for%20my%20remote%20staff.%26nbsp%3B%20The%20data%20is%20captured%20online%20via%20a%20third%20party%20tool.%26nbsp%3B%20We%20then%20generate%20an%20excel%20file%20from%20this%20data%20and%20link%20this%20to%20our%20Access%20tools.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20field%20data%20there%20are%20many%20fields%20where%20the%20text%20exceeds%20256%20characters%2C%20however%20this%20is%20not%20consistent%20and%20varies%20job%20to%20job%20and%20week%20to%20week.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20data%20forms%20part%20of%20our%20invoicing.%26nbsp%3B%20I%20had%20previously%20noted%20many%20records%20are%20truncated%20on%20the%20clients%20invoices%2C%20however%20i%20put%20it%20to%20one%20side%20as%20something%20I%20will%20look%20at%20when%20I%20have%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20issue%20is%20the%20information%20in%20the%20spreadsheet%20is%3A%3C%2FP%3E%3CP%3E%3CEM%3Esite%20inspection%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Efilter%20has%20not%20been%20cleaned%20since%20handover%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Erecommended%20to%20clean%20asap%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Eremove%20and%20inspect%20level%20sensor%20probes%20all%20ok%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Ewhile%20probes%20remove%20ensure%20auto%20fill%20comes%20on%20and%20turns%20off%20once%20refitted%20into%20gutter%20all%20ok%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Ecomplete%20results-%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EFac%203.92%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ETcc%204.11%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EpH%207.46%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ECys%2039%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ETa%2036%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ECah%2070%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ETemp%2025.6%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ETDS%201300%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Echeck%20results%20against%20controller%20all%20ok%20no%20calibration%20required%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Esuggested%20increase%20ch%20to%20300-400%20and%20cys%20to%2050%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Echeck%20heater%20operating%20all%20ok%3C%2FEM%3E%3C%2FP%3E%3CP%3EWhich%20I%20want%20to%20send%20to%20this%20client.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20version%20I%20am%20seeing%20in%20Access%20after%20import%20is%3A%3C%2FP%3E%3CP%3E%3CEM%3Esite%20inspection%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Efilter%20has%20not%20been%20cleaned%20since%20handover%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Erecommended%20to%20clean%20asap%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Eremove%20and%20inspect%20level%20sensor%20probes%20all%20ok%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Ewhile%20probes%20remove%20ensure%20auto%20fill%20comes%20on%20and%20turns%20off%20once%20refitted%20into%20gutter%20all%20ok%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EQuite%20severely%20trimmed%20and%20truncated.%26nbsp%3B%20To%20the%20point%20it%20is%20changing%20the%20meaning%20to%20the%20client.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20cant%20afford%20to%20spend%20the%20time%20picking%20out%20the%20specific%20jobs%20that%20this%20impacts%20and%20going%20back%20months%2C%20as%20I%20had%20to%20do%20for%20this%20example%2C%20to%20find%20the%20correct%20wording.%26nbsp%3B%20From%20what%20I%20read%20this%20is%20something%20to%20do%20with%20Excel%20and%20Access%20not%20playing%20nicely%20together.%26nbsp%3B%20I%20cant%20use%20the%20Wizard%20as%20this%20process%20is%20run%20overnight%20and%20is%20intended%20to%20be%20complete%20for%20me%20to%20invoice%20weekly%20as%20the%20jobs%20are%20finally%20completed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20work%20around%2C%20that%20doesn't%20involve%20manually%20importing%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2219205%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

I have had a look at several forum discussions, however I cant see a work around.

 

Weekly we are importing time cards for my remote staff.  The data is captured online via a third party tool.  We then generate an excel file from this data and link this to our Access tools.

 

In the field data there are many fields where the text exceeds 256 characters, however this is not consistent and varies job to job and week to week.

 

The data forms part of our invoicing.  I had previously noted many records are truncated on the clients invoices, however i put it to one side as something I will look at when I have time.

 

The issue is the information in the spreadsheet is:

site inspection
filter has not been cleaned since handover
recommended to clean asap
remove and inspect level sensor probes all ok
while probes remove ensure auto fill comes on and turns off once refitted into gutter all ok
complete results-
Fac 3.92
Tcc 4.11
pH 7.46
Cys 39
Ta 36
Cah 70
Temp 25.6
TDS 1300
check results against controller all ok no calibration required
suggested increase ch to 300-400 and cys to 50
check heater operating all ok

Which I want to send to this client.

 

The version I am seeing in Access after import is:

site inspection
filter has not been cleaned since handover
recommended to clean asap
remove and inspect level sensor probes all ok
while probes remove ensure auto fill comes on and turns off once refitted into gutter all ok

 

Quite severely trimmed and truncated.  To the point it is changing the meaning to the client.

 

I cant afford to spend the time picking out the specific jobs that this impacts and going back months, as I had to do for this example, to find the correct wording.  From what I read this is something to do with Excel and Access not playing nicely together.  I cant use the Wizard as this process is run overnight and is intended to be complete for me to invoice weekly as the jobs are finally completed.

 

Is there a work around, that doesn't involve manually importing?

 

4 Replies
It's quit difficult to understand the core issue since you are using the third party tool to read data in to Excel & others,,, better contact to the vendor supporting you,, possibly U get some solution !!
Thats not it.

I have a work around. If I insert 9 rows of nonsense containing 500 characters or so this then forces Access to import the field correctly.

However this is a horrid work around and not something I really want to do every week. There has to be a better way.
If you want to take the matter in your hands you need to use Excel Automation...in this case Access will treat Excel as an Object...read the cells and transfer them to a temp table where you can manipulate them to your liking...in this way you are stopping Access from making guesses on what datatype you have thus giving the confusion
I second John's recommendation. You can't have it both ways, "Little effort" is not compatible with "Perfect results".

The most common way to resolve data problems during import from Excel is to import all of the data as text into a staging table in Access. Don't try to second-guess datatypes. Make sure everything is imported into a field with the same name as the source column in Excel (assuming that vendor's product provides column titles you can use). Then, in a series of append and update queries in Access you can manipulate the data into proper datatypes, using CDate(), CLng(), CDbl(), etc.and put it in the proper final target table(s).
You can automate this to run from a macro and use Window's Task Scheduler to open the accdb and run the macro at the appropriate time during the night,