Hi Frank:
Not sure what you are trying to say, but it seems that you get a DSum error
when the form is not populated with records. Why don't you place either in a
clickbutton or on your form's OnCurrent event the following code- it'll
check to see if there are records or not:
Dim dbs as database
Dim SQLStmt as string
Dim rst as recordset
Set dbs = CurrentDb()
SQLStmt = "SELECT YOURTABLE.* FROM YOURTABLE WHERE
([CurrentReccordACCT]= " & Me![ACCT] & ");"
Set rst = dbs.OpenRecordset(SQLStmt, dbOpenSnapshot)
On Error Resume Next
rst.MoveFirst
If rst.EOF Then
MsgBox "There are no records."
Else
[DSumField] = DSum("[pg_valorapagar]";"[QryDetalhePagamentoCliente",
[CurrentReccordACCT] = " & Me![ACCT])
End If
Alternatively, you can do this to prevent the #ERROR:
[DSumField] =
IIF(IsNull(DSum("[pg_valorapagar]";"[QryDetalhePagamentoCliente",
[CurrentReccordACCT] = " & Me![ACCT]),"",
DSum("[pg_valorapagar]";"[QryDetalhePagamentoCliente", [CurrentReccordACCT]
= " & Me![ACCT]))
Regards,
Al
Frank Dulk said:
I have that it formulates in a control in the form, because when doesn't
have records appears #Error.
=DSoma("[pg_valorapagar]";"[QryDetalhePagamentoCliente]";"[pg_datapagamento]