Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2000 VBA undefined function problem
Hi all!
In the code below, I am getting the error "Undefined Function Weeknumber in the expression". The query qryManagementControlReport01 is an Access 2000 query, and there is a module in the Access database defined by connDB that has the function WeekNumber in it. WeekNumber is also defined in my Excel spreadsheet in the same module as this code is executed from. I read somewhere it wasn't possible to exceute an Access module from an Excel VBA module, and I had hoped that creating the query in Access would resolve the need to make the call. The query in Access runs as expected. The Excel module compiles and Saves without error. How do I get this to work? Any help would be greatly appreciated, Thanks Matt. Excel intWeekHolder = WeekNumber(ExcelDate) strSQL = "SELECT SumPartsPlan " _ & "FROM qryManagementControlReport01 " _ & "WHERE YearWeek = " & Year(ExcelDate) & "-" & IIf(Len(intWeekHolder) = 1, "0" & intWeekHolder, intWeekHolder) Set rsJobs = connDB.Execute(strSQL) Cells(intCurRow, intCurCol + 2).Value = rsJobs("SumPartsPlan") Access SELECT Year(CurrentDate) & "-" & IIf(LEN(WeekNumber(CurrentDate))=2,WeekNumber(Curr entDate),"0" & WeekNumber(CurrentDate)) AS YearWeek, SUM([GoodParts-Plan]) AS SumPartsPlan FROM tblDailyProduction GROUP BY Year(CurrentDate) & "-" & IIf(LEN(WeekNumber(CurrentDate))=2,WeekNumber(Curr entDate),"0" & WeekNumber(CurrentDate)) ORDER BY Year(CurrentDate) & "-" & IIf(LEN(WeekNumber(CurrentDate))=2,WeekNumber(Curr entDate),"0" & WeekNumber(CurrentDate)); |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | Excel Discussion (Misc queries) | |||
Excel error: Undefined Function 'InStrRev' in Expression | Excel Worksheet Functions | |||
IF Function Problem Excel 2000 | Excel Worksheet Functions | |||
Undefined function error | Excel Discussion (Misc queries) | |||
undefined function error when creating xls pivot from mdb qry | Excel Worksheet Functions |