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
|
|||
|
|||
DSUM Syntax Error
I am getting the following suntax error: "Syntax error in string in
query expression '[MonthNum]=6'""(second quote is not in the error screen). Here is my DSum expression: Test: DSum("Units","tblMonthlyUnits","[MonthNum]=" & CStr(DatePart("m",dhpreviousworkdaya(Date()))) & """"). The tblMonthlyUnits is set up as follows: MonthNum(Dbl) Sample: 1, 2, 3, 4, 5, ... MonthName(Txt) Sample: Jan, Feb, Mar, Apr, ... Units(Dbl) Sample: 2.51, 2.03, 2.67, 1.89, 2.54, ... Why am I getting the error? If I change the criteria part of the DSum to "[MonthNum]=6", it works fine. I have tried without changing the DatePart function to a string, also changing to Double with CDbl and without change at all and I receive the same error. Could it be the 4 quotation marks at the end? |
#2
|
|||
|
|||
DSUM Syntax Error
On Jun 30, 3:37*pm, NeoFax wrote:
I am getting the following suntax error: "Syntax error in string in query expression '[MonthNum]=6'""(second quote is not in the error screen). *Here is my DSum expression: *Test: DSum("Units","tblMonthlyUnits","[MonthNum]=" & CStr(DatePart("m",dhpreviousworkdaya(Date()))) & """"). *The tblMonthlyUnits is set up as follows: MonthNum(Dbl) Sample: 1, 2, 3, 4, 5, ... MonthName(Txt) Sample: Jan, Feb, Mar, Apr, ... Units(Dbl) *Sample: 2.51, 2.03, 2.67, 1.89, 2.54, ... Why am I getting the error? *If I change the criteria part of the DSum to "[MonthNum]=6", it works fine. *I have tried without changing the DatePart function to a string, also changing to Double with CDbl and without change at all and I receive the same error. *Could it be the 4 quotation marks at the end? Fixed it myself. Here is the final DSUM: DSum("Units","tblMonthlyUnits","[MonthNum]=" & CDbl(DatePart("m",dhpreviousworkdaya(Date())))). Didn't need to concatenate the quotations as the DatePart returns a number value and not a string. Now my new dilemma is figuring out how to sum the values of a column. |
Thread Tools | |
Display Modes | |
|
|