I've written a function that takes three integers and returns a double. Any time I try to call it from a query it returns an error; select query will return #error, update or make table return a type conversion failure. ??
1) The code works fine when run in the immediate window of VBA editor
2) I'm sure that the values I'm passing it are of the correct type (integer)
3) I've tried update queries where the field for the calculated value is double (what it should be), variant, and text; all give type conversion error
4) When I first tested the code it worked fine, except that certain calls resulted in division by zero. I changed one line of arithmatic code, now I'm having this problem
sample SQL select query is
Thanks for any help, I'm baffled!
1) The code works fine when run in the immediate window of VBA editor
2) I'm sure that the values I'm passing it are of the correct type (integer)
3) I've tried update queries where the field for the calculated value is double (what it should be), variant, and text; all give type conversion error
4) When I first tested the code it worked fine, except that certain calls resulted in division by zero. I changed one line of arithmatic code, now I'm having this problem
Code:
Function plot_live_C(intInst As Integer, intPlot As Integer, intMeas As Integer) As Double
'some stuff happens in here, works great in VBA editor
plot_live_c=dblTotalC
exit function
sample SQL select query is
Code:
SELECT tMeasurement_Dates.installation, tMeasurement_Dates.plot, tMeasurement_Dates.measurement, plot_live_C([tMeasurement_Dates]![installation]),([tMeasurement_Dates]![plot],[tMeasurement_Dates]![measurement]) AS liveC
FROM tMeasurement_Dates;
Thanks for any help, I'm baffled!