MISTAKE of INCORRECT TYPE

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

Frank Dulk

The one that this wandered here

Dim rstDebito As Recordset
Dim rstVale As Recordset
Dim strCodCx As String
Dim strDtJogoInicial As Date
Dim strCriteria As String
Dim CurVale As Double
Dim CurDtLanc As String

' Entrance of Parameters for I Calculate of you are Worth, based on the
field Debit of TbJogo'

Set rstDebito = CurrentDb.OpenRecordset("TbVales")
strCodCx = InputBox("Código do Caixa ?")
strDtJogoInicial = InputBox("Dt do Jogo ?")

' I calculate of the Sum of all the Debits based on the parameters passed

CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx And
"'[DtJogo]='" & "#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")
 
Hello Frank. Long-time-no-see!

This is all I could find wrong:
CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx And
"'[DtJogo]='" & "#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")

Fix it like so:
CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx & _
"' And [DtJogo]=#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
Hi, it is a pleasure to receive your help, I am really a missing well, I am
with a problem in an inventory system that not this occurring me time for
participating in the forum.

I am going your forehead answer and returns the tell you something.

Thank you very much

Graham R Seach said:
Hello Frank. Long-time-no-see!

This is all I could find wrong:
CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx And
"'[DtJogo]='" & "#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")

Fix it like so:
CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx & _
"' And [DtJogo]=#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


Frank Dulk said:
The one that this wandered here

Dim rstDebito As Recordset
Dim rstVale As Recordset
Dim strCodCx As String
Dim strDtJogoInicial As Date
Dim strCriteria As String
Dim CurVale As Double
Dim CurDtLanc As String

' Entrance of Parameters for I Calculate of you are Worth, based on the
field Debit of TbJogo'

Set rstDebito = CurrentDb.OpenRecordset("TbVales")
strCodCx = InputBox("Código do Caixa ?")
strDtJogoInicial = InputBox("Dt do Jogo ?")

' I calculate of the Sum of all the Debits based on the parameters passed

CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx And
"'[DtJogo]='" & "#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")
 
I made the Alterations it conforms below and he/she gives the following
message MISTAKE OF SYNTAX (Operator is Absent) in the query " expression
[CodCx] = ' 1 ' AND [DtJogo]=#04/04/2004#'

Dim rstDebito As Recordset
Dim rstVale As Recordset
Dim strCodCx As Integer
Dim strDtJogo As Date
Dim strCriteria As String
Dim CurValeSoma As Double
Dim CurValeTb As Double

' Entrance of Parameters for I Calculate him/it of you are Worth, based on
the field Debit of TbJogo'

Set rstDebito = CurrentDb.OpenRecordset("TbVales")
strCodCx = InputBox("Código do Caixa ?")
strDtJogo = InputBox("Dt do Jogo ?")

' I calculate of the Sum of all the Debits based on the parameters

CurValeSoma = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx & "' And
[DtJogo]=#" & Format(strDtJogo, "dd/mm/yyyy") & "#")

I don't know what to do.

Hugs


Graham R Seach said:
Hello Frank. Long-time-no-see!

This is all I could find wrong:
CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx And
"'[DtJogo]='" & "#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")

Fix it like so:
CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx & _
"' And [DtJogo]=#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


Frank Dulk said:
The one that this wandered here

Dim rstDebito As Recordset
Dim rstVale As Recordset
Dim strCodCx As String
Dim strDtJogoInicial As Date
Dim strCriteria As String
Dim CurVale As Double
Dim CurDtLanc As String

' Entrance of Parameters for I Calculate of you are Worth, based on the
field Debit of TbJogo'

Set rstDebito = CurrentDb.OpenRecordset("TbVales")
strCodCx = InputBox("Código do Caixa ?")
strDtJogoInicial = InputBox("Dt do Jogo ?")

' I calculate of the Sum of all the Debits based on the parameters passed

CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx And
"'[DtJogo]='" & "#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")
 
Frank,

1. You've declared CodCx as an Integer, but named it as if it were a String.
Not a good idea!
Dim strCodCx As Integer

2. Also, you need to make up your mind whether strDtJogo is a Date or
String!

Change the query as show below:
CurValeSoma = DSum("[Debito]", "TbVales", "'[CodCx] =" & strCodCx & "
And
[DtJogo]=#" & Format(strDtJogo, "dd/mm/yyyy") & "#")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


Frank Dulk said:
I made the Alterations it conforms below and he/she gives the following
message MISTAKE OF SYNTAX (Operator is Absent) in the query " expression
[CodCx] = ' 1 ' AND [DtJogo]=#04/04/2004#'

Dim rstDebito As Recordset
Dim rstVale As Recordset
Dim strCodCx As Integer
Dim strDtJogo As Date
Dim strCriteria As String
Dim CurValeSoma As Double
Dim CurValeTb As Double

' Entrance of Parameters for I Calculate him/it of you are Worth, based on
the field Debit of TbJogo'

Set rstDebito = CurrentDb.OpenRecordset("TbVales")
strCodCx = InputBox("Código do Caixa ?")
strDtJogo = InputBox("Dt do Jogo ?")

' I calculate of the Sum of all the Debits based on the parameters

CurValeSoma = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx & "' And
[DtJogo]=#" & Format(strDtJogo, "dd/mm/yyyy") & "#")

I don't know what to do.

Hugs


Graham R Seach said:
Hello Frank. Long-time-no-see!

This is all I could find wrong:
CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx And
"'[DtJogo]='" & "#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")

Fix it like so:
CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx & _
"' And [DtJogo]=#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


Frank Dulk said:
The one that this wandered here

Dim rstDebito As Recordset
Dim rstVale As Recordset
Dim strCodCx As String
Dim strDtJogoInicial As Date
Dim strCriteria As String
Dim CurVale As Double
Dim CurDtLanc As String

' Entrance of Parameters for I Calculate of you are Worth, based on the
field Debit of TbJogo'

Set rstDebito = CurrentDb.OpenRecordset("TbVales")
strCodCx = InputBox("Código do Caixa ?")
strDtJogoInicial = InputBox("Dt do Jogo ?")

' I calculate of the Sum of all the Debits based on the parameters passed

CurVale = DSum("[Debito]", "TbVales", "'[CodCx] ='" & strCodCx And
"'[DtJogo]='" & "#" & Format(strDtJogoInicial, "dd/mm/yyyy") & "#")
 
Back
Top