I wander in time of execution ' 2427 '

  • Thread starter Thread starter Frank Dulk
  • Start date Start date
F

Frank Dulk

I know that the mistake above, corresponds an expression return without
value, in other words, my select coming back null.

Do excuse the ignorance, but, as I can foresee in my select the null so that
my program doesn't tumble??

Code:
Set RsSal = CurrentDb.OpenRecordset("select Sum Nz((VlrSal),0) As TotAnt
from TabSaldo Where Empsal=" & EmpMov & "and Contsal=" & ContaMov & "and
DataSal<#" & [Format[DataMov, "m/d/yyyy") & "#"))
 
Frank Dulk said:
I know that the mistake above, corresponds an expression return
without value, in other words, my select coming back null.

Do excuse the ignorance, but, as I can foresee in my select the null
so that my program doesn't tumble??

Code:
Set RsSal = CurrentDb.OpenRecordset("select Sum Nz((VlrSal),0) As
TotAnt from TabSaldo Where Empsal=" & EmpMov & "and Contsal=" &
ContaMov & "and DataSal<#" & [Format[DataMov, "m/d/yyyy") & "#"))

There is a typo in that SQL statement, but I'll assume that the original
is valid.

If no records are returned by the query, the recordset's RecordCount
property will be equal to zero. So you would test that before trying to
reference RsSal!TotAnt.
 
Back
Top