I'm working on a querry but it shows a calclation from some data in the table the problem is the calculation is to long and complex to fit in the query field...so it wont let me do it. anyone got any ideas how I can fix this? Thanks.
Thanks, that helped. But I'm getting weird errors for some reason. on some records.
here is my function.
Public Function AccPassing_6(DryMass as Double, Mass_6 as Double) As Variant
if(DryMass <> Null)then
AccPassing_6 = (100-((1/DryMass) * Mass_6 * 100))
else
AccPassing_6 = Null
endif
end function
But on a few records I get #error as the answer and I dont see why.
I tried putting an IIf statment in the query field..like iif(bla > 0, call my function, null)
that kinda worked..but why doesn't the code in my function seem to work for every record?
Don't explicit declare a data type for the function parameters (DryMass and Mss_6). Allow them to be variants. Then if the column in the table is Null the function call won't fail as it does not when the params are declared as Double.
I would also make some other minor modifications to the function.
Public Function AccPassing_6(DryMass, Mass_6) As Variant
If Isnumeric(DryMass) And IsNumeric(Mass_6) Then
AccPassing_6 = 100-(Mass_6 / DryMass * 100)
Else
AccPassing_6 = Null
EndIf
end function Terry L. Broadbent - DBA
Computing Links:
Thanks a lot, I got it working now I figured out the variant part a little after I posted my message. I didn't use isnumeric..but what I did works I think.
If(Nz(DryMass+0)>0 And Nz(Mass_6+0)>0)then
bla bla
else
bla bla
endif
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.