If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
#Error
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] is null") |
#2
|
|||
|
|||
#Error
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" wrote in message ... 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] is null") |
#3
|
|||
|
|||
#Error
Would not have as I outline that direct mistake in the origin of the control
where I use the function DSUM? "Al Borges" alborgmd at yahoo dot com escreveu na mensagem ... 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" wrote in message ... 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] is null") |
#4
|
|||
|
|||
#Error
Hi Frank:
You can use the second method right in your control, if you wish (i.e. the one that uses the IIF...). Regards, Al "Frank Dulk" wrote in message ... Would not have as I outline that direct mistake in the origin of the control where I use the function DSUM? "Al Borges" alborgmd at yahoo dot com escreveu na mensagem ... 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" wrote in message ... 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] is null") |
Thread Tools | |
Display Modes | |
|
|