Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to trap a error returned by excel in access

Status
Not open for further replies.

funloving

Programmer
Apr 3, 2009
12
CA
I have an excel sheet which is calculating some value based on some value sent by access. Sometimes in the Excel sheet you can have a #value if there is no result. Now if Excel returns a #value how do i trap it in Access..Any help is appreciated.
 
Two thoughts.

First, you might have better luck in the office VBA forum because people there are more likely to use Excel and VBA. Are you automating Excel? If not, you will have to.

Secondly, Why? Surely any calculation you are doing in Excel you can do in Access. The test in Access is likely far simpler. Even so, you may be able to find what data gives you #value (probably a null or zero length string somewhere) and test for it before you send the data to Excel.
 
Thanks for the reply...

Answer to your first question is: there is this Poisson formula available in Excel not available in Access.
Thats the reason I am using Excel.

And thanks for the tip thats exactly what I did and found that it worked perfectly.

Appreciate your patience.



 
Having just looked in Excel help, it looks like the funtion takes three parameters and returns a value.

In Access, you could do two things to avoid dumping to Excel.

Write your own function to do the same as Poisson. In my experience it is better to build a string for any arithmetic expression and use the eval function to evaluate it to lessen any floating point issues.

Alternately, you could set a reference to Excel in a module (tools references). Then you should be able to write your own wrapper function for the Excel function and use it in your query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top