miketheitguy
MIS
Any ideas as to why access is giving me the error that this function is undefined? It's entered as you see below and is compiled without errors.
---------------------BEGIN CODE
Option Explicit
Function Getwkdate()
Dim currentdate As String
currentdate = Getwkdate
Select Case currentdate
Case "Sunday" ' Sunday
Getwkdate = "" & Date - Weekday(Date) + 1
Case "Monday" ' Monday
Getwkdate = "" & Date - Weekday(Date) + 2
Case "Tuesday"
Getwkdate = "" & Date - Weekday(Date) + 3
Case "Wednesday"
Getwkdate = "" & Date - Weekday(Date) + 4
Case "Thurday"
Getwkdate = "" & Date - Weekday(Date) + 5
Case "Friday"
Getwkdate = "" & Date - Weekday(Date) + 6
Case "Saturday"
Getwkdate = "" & Date - Weekday(Date) + 7
End Select
End Function
---------------------------END CODE
A little background. I am attemtping to extrapolate the date based on a day name. I have a form designed to print a set of reports for any day of the week. You select the day from the combo box and it calls a report based on a query that selects data with the day selected in the combo box as it's criteria.
Example:
myday has it's criteria set to form_name!combo_box
wkdaydate: getwkdate([myday])
It looks simple enough, the function compiles with no errors but Access tells me it's undefined.
---------------------BEGIN CODE
Option Explicit
Function Getwkdate()
Dim currentdate As String
currentdate = Getwkdate
Select Case currentdate
Case "Sunday" ' Sunday
Getwkdate = "" & Date - Weekday(Date) + 1
Case "Monday" ' Monday
Getwkdate = "" & Date - Weekday(Date) + 2
Case "Tuesday"
Getwkdate = "" & Date - Weekday(Date) + 3
Case "Wednesday"
Getwkdate = "" & Date - Weekday(Date) + 4
Case "Thurday"
Getwkdate = "" & Date - Weekday(Date) + 5
Case "Friday"
Getwkdate = "" & Date - Weekday(Date) + 6
Case "Saturday"
Getwkdate = "" & Date - Weekday(Date) + 7
End Select
End Function
---------------------------END CODE
A little background. I am attemtping to extrapolate the date based on a day name. I have a form designed to print a set of reports for any day of the week. You select the day from the combo box and it calls a report based on a query that selects data with the day selected in the combo box as it's criteria.
Example:
myday has it's criteria set to form_name!combo_box
wkdaydate: getwkdate([myday])
It looks simple enough, the function compiles with no errors but Access tells me it's undefined.