Erroneous Errors!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've a link table with excel to access. some fields have a #NUM! - I cannot
change the excel sheet because that is generated by another process over
which I have no control. I want to filter out the #NUM! and have tried
building an expression such as IIf(IsError.... but that stubborn #NUM!
doesn't want to disappear. Any hints please?
 
Presumably, some entries in an Excel field that Access is treating as
Numeric aren't! You need to be a little more specific about what you
are trying to do, and in what context.

I've a link table with excel to access. some fields have a #NUM! - I cannot
change the excel sheet because that is generated by another process over
which I have no control. I want to filter out the #NUM! and have tried
building an expression such as IIf(IsError.... but that stubborn #NUM!
doesn't want to disappear. Any hints please?


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Hi Peter,
The Excel fields are supposed to be a series of numbers exported from a
proprietary database whose properties I cannot change. The database
generates a series of tables (addresses in one, figures in an other) and
these are the tables I download and save onto my machine. In the numerical
table most of the export fields are populated but those which aren't give
rise to the #NUM! in the table I download. Because the excel table is
overwritten every time a new download is done I cannot simply put in a
formula into Excel. In fact that would be cumbersome because I cannot know
in advance if I shall have 50 lines, 100 lines or 500 lines of output. Once
I download the table it is then treated as a link table to an Access Database
which does some more work on the tables to transform them into a form that is
acceptable to themaster database. This work involves renaming some fields,
ordering them in a different fashion and linking up some information. This
is all secondary to the first task which is to clean up the information by
replacing (for example) #NUM! by something more understandable to
non-technical users say "n/a" for example or even ""
Hope I have been clear!
Jon
 
An interesting problem! (Don't you just hate interesting problems?!).

Some experimentation confirms that non-numeric values in fields in a
column of an Excel spreadsheet which has been linked as a numeric
field in an Access Table cause a "level" of error (if you try to
reference that field in a query) which, in essence, prevents you from
doing anything useful at all with that field. I can see the logic
behind this, but it is a pain when you want to do the sort of thing
that you are trying to do.

I can think of a number of ways of getting around this - none of them
is terribly simple, but the second would probably be my preference:

1) Instead of _linking_ to the spreadsheet table, _import_ it as a new
temporary Access Table. The Import wizard will give you the same
default data types for your spreadsheet columns, but rows containing
data that cannot be converted will be turfed into a separate
"Conversion Error" Table, which you can handle separately.

2) Again, instead of linking, import the spreadsheet data into an
existing (previously cleared) table, in which all the fields which
should be numeric but may contain non-numeric data are declared as
Text fields. You can then use a Query to apply IsNumeric() to these
questionable fields, convert the valid results to numbers and return
what you want for the invalid ones.

3) Link as you originally did, but write a Function to scan through a
Recordset based on the linked Table, record by record, appending the
data to a second temporary Table which you will use for your
subsequent processing. In order to copy the records, you will
obviously have to "look at" the value of each field - trap and handle
appropriately the errors which will be thrown when you try to look at
the "bad" values.

Hi Peter,
The Excel fields are supposed to be a series of numbers exported from a
proprietary database whose properties I cannot change. The database
generates a series of tables (addresses in one, figures in an other) and
these are the tables I download and save onto my machine. In the numerical
table most of the export fields are populated but those which aren't give
rise to the #NUM! in the table I download. Because the excel table is
overwritten every time a new download is done I cannot simply put in a
formula into Excel. In fact that would be cumbersome because I cannot know
in advance if I shall have 50 lines, 100 lines or 500 lines of output. Once
I download the table it is then treated as a link table to an Access Database
which does some more work on the tables to transform them into a form that is
acceptable to themaster database. This work involves renaming some fields,
ordering them in a different fashion and linking up some information. This
is all secondary to the first task which is to clean up the information by
replacing (for example) #NUM! by something more understandable to
non-technical users say "n/a" for example or even ""
Hope I have been clear!
Jon


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Hi Peter, Thanks for this. Well, interesting problems are what life is all
about; after all, if everything worked we might just lose interest... I will
have to experiment. I went through option "2" but actually although I got
the IsNumeric() to work when the number is a number it was still being
stubborn on the #NUM1. I converted everything to text and still had the same
problem (breaking the link and re-getting external data). I then did a find
and replace by putting zeros in and that worked but of course the issue will
be how to automate that. I don't want the database operator to fiddle -
they'd do it wrong anyway... I think I understand what you suggest in the
final option but that will require some experimentation. The max number of
records we'd ever have to deal with would be 200 or so with 24 columns of
numbers. That should not slow down the process. I do not have enough
experience so will have to start climbing the knowledge/experience curve!
Thanks for your help.
 
Back
Top