There is some punctuation code differences between these two lines.
Sent from Mail for Windows
From: Paul Baldy
Sent: Wednesday, March 9, 2022 2:56 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Syntax error
Oops, thanks Duane.
Paul
Sent via mobile device
-------- Original message --------
From: Duane Hookom <duanehookom@hotmail.com>
Date: 3/9/22 2:49 PM (GMT-08:00)
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Syntax error
I think there are some missing double-quotes before the final ")".
TotalDebit = DSum("[AmountDebitFrom]", "Qry_TransactionsFullData", "[AccountID] = '" & txtAccountID & "' AND Val([RecordCode]) <= " & VRecordCode & " AND [TransactionTypeID]= 2")
If as you mentioned all criteria a text data types:
TotalDebit = DSum("[AmountDebitFrom]", "Qry_TransactionsFullData", "[AccountID] = '" & txtAccountID & "' AND Val([RecordCode]) <= '" & VRecordCode & "' AND [TransactionTypeID]= '2'")
Duane
From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Paul Baldy <Pbaldy@gmail.com>
Sent: Wednesday, March 9, 2022 11:40 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Syntax error
You have a lot of unnecessary concatenation in there. Try
TotalDebit = DSum("[AmountDebitFrom]", "Qry_TransactionsFullData", "[AccountID] = '" & txtAccountID & "' AND Val([RecordCode]) <= " & VRecordCode & " AND [TransactionTypeID]= 2)
If as you mentioned all criteria a text data types:
TotalDebit = DSum("[AmountDebitFrom]", "Qry_TransactionsFullData", "[AccountID] = '" & txtAccountID & "' AND Val([RecordCode]) <= '" & VRecordCode & "' AND [TransactionTypeID]= '2')
Paul
------ Original Message ------
From: "Youssef" <youssef2309@gmail.com>
Sent: 3/9/2022 9:37:30 AM
Subject: Re: [MSAccessProfessionals] Syntax error
Dear Mr. Paul,
thanks for your support
I've updated the syntax and still get the message (expected: list separator or ) )
I can't notice the mistakeplease support again
TotalDebit = DSum("[AmountDebitFrom]", "Qry_TransactionsFullData", "[AccountID] = '" & txtAccountID & "'" & " AND Val([RecordCode]) <= " & VRecordCode & " AND [TransactionTypeID]= '" & 2 & "'" & ")thanks in advance