I am trying to use WeekdayName in a cross tab query. It causes an error. I am looking for a work-a-round for this.
The following statement is from the MS Access2000 Knowledge base:
"When you use one of the new Visual Basic for Applications functions as an expression, you may receive the #Name? error value. For example, if you set the ControlSource property of a text box to the expression =WeekdayName(6), the text box returns #Name? instead of the value Friday.
CAUSE
The FormatCurrency(), FormatDateTime(), FormatNumber(), FormatPercent(), InStrRev(), MonthName(), Replace(), Round(), StrReverse() and WeekdayName() functions are not supported as expressions."
The following is the SQL code I am trying to use in a CrossTab Query.:
SELECT T_Days.DayNum, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),[DayNum],Null) AS Dnm, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),WeekdayName(Weekday(DateSerial(Fn_GetNu m("CboYr"),Fn_GetNum("CboMn"),[DayNum])),True),Null) AS WkDay, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),Weekday(DateSerial(Fn_GetNum("CboYr"),F n_GetNum("CboMn"),[DayNum])),Null) AS WkD, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),DatePart("ww",DateSerial(Fn_GetNum("Cbo Yr"),Fn_GetNum("CboMn"),[DayNum]))-DatePart("ww",DateSerial(Fn_GetNum("CboYr"),Fn_Get Num("CboMn"),1))+1,Null) AS WkNum, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),DatePart("ww",DateSerial(Fn_GetNum("Cbo Yr"),Fn_GetNum("CboMn"),[DayNum]))-DatePart("ww",DateSerial(Fn_GetNum("CboYr"),Fn_Get Num("CboMn"),1))+1,Null) & IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),Weekday(DateSerial(Fn_GetNum("CboYr"),F n_GetNum("CboMn"),[DayNum])),Null) AS WkNumWKD
FROM T_Days;
I get the following error message: "Undefined function 'WeekdayName" in expression."
I hope someone can help.
Thanks, billywt
The following statement is from the MS Access2000 Knowledge base:
"When you use one of the new Visual Basic for Applications functions as an expression, you may receive the #Name? error value. For example, if you set the ControlSource property of a text box to the expression =WeekdayName(6), the text box returns #Name? instead of the value Friday.
CAUSE
The FormatCurrency(), FormatDateTime(), FormatNumber(), FormatPercent(), InStrRev(), MonthName(), Replace(), Round(), StrReverse() and WeekdayName() functions are not supported as expressions."
The following is the SQL code I am trying to use in a CrossTab Query.:
SELECT T_Days.DayNum, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),[DayNum],Null) AS Dnm, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),WeekdayName(Weekday(DateSerial(Fn_GetNu m("CboYr"),Fn_GetNum("CboMn"),[DayNum])),True),Null) AS WkDay, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),Weekday(DateSerial(Fn_GetNum("CboYr"),F n_GetNum("CboMn"),[DayNum])),Null) AS WkD, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),DatePart("ww",DateSerial(Fn_GetNum("Cbo Yr"),Fn_GetNum("CboMn"),[DayNum]))-DatePart("ww",DateSerial(Fn_GetNum("CboYr"),Fn_Get Num("CboMn"),1))+1,Null) AS WkNum, IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),DatePart("ww",DateSerial(Fn_GetNum("Cbo Yr"),Fn_GetNum("CboMn"),[DayNum]))-DatePart("ww",DateSerial(Fn_GetNum("CboYr"),Fn_Get Num("CboMn"),1))+1,Null) & IIf([DayNum]<=Day(DateSerial(Fn_GetNum("CboYr"),Fn_GetNum("Cbo Mn")+1,0)),Weekday(DateSerial(Fn_GetNum("CboYr"),F n_GetNum("CboMn"),[DayNum])),Null) AS WkNumWKD
FROM T_Days;
I get the following error message: "Undefined function 'WeekdayName" in expression."
I hope someone can help.
Thanks, billywt