LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] Excel Discussion (Misc queries) 2 September 10th 08 11:07 AM
Excel error: Undefined Function 'InStrRev' in Expression TerryD Excel Worksheet Functions 4 February 6th 07 02:43 PM
IF Function Problem Excel 2000 david@pcm Excel Worksheet Functions 4 September 28th 06 12:40 PM
Undefined function error CLamar Excel Discussion (Misc queries) 3 June 5th 06 07:07 PM
undefined function error when creating xls pivot from mdb qry andrew Excel Worksheet Functions 0 July 29th 05 07:26 PM


All times are GMT +1. The time now is 02:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"