A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#Error



 
 
Thread Tools Display Modes
  #1  
Old June 16th, 2004, 03:28 AM
Frank Dulk
external usenet poster
 
Posts: n/a
Default #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  
Old June 16th, 2004, 08:10 AM
Al Borges
external usenet poster
 
Posts: n/a
Default #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  
Old June 17th, 2004, 03:17 AM
Frank Dulk
external usenet poster
 
Posts: n/a
Default #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  
Old June 17th, 2004, 12:22 PM
Al Borges
external usenet poster
 
Posts: n/a
Default #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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.