I have a function checking two controls Saldo and Stock. Sometimes one of
the two controls may be empty, having no figures in it.In this case I want to
give the command to exit the function.For example, when the control stock is
empty, I get the following message :
You tried to execute a query that does not include the specified expression
“stock” as part of an aggregate function
I do not want to break the function, for the function has other tasks to do,I
just want to have no messages for an error but jist skip it. How coul I do it
?
Part of my function is the following :
Dim F As Form
Set F = Forms!FBenchmark
If Nz(F!Saldo) <> Nz(F!stock) Then
Alex Dybenko - 29 May 2008 08:06 GMT
Hi,
you can check for empty as IsNull(F!stock) or Len(F!stock & "")=0
Set F = Forms!FBenchmark
if Len(F!stock & "") >0 then
If Nz(F!Saldo) <> Nz(F!stock) Then
...

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
>I have a function checking two controls Saldo and Stock. Sometimes one of
> the two controls may be empty, having no figures in it.In this case I want
[quoted text clipped - 14 lines]
> Set F = Forms!FBenchmark
> If Nz(F!Saldo) <> Nz(F!stock) Then