I am trying to adjust my DCOUNT function to also use Country field as a criteria to determine if a date is a Holiday.
I have a table (Holidays) with 2 fields on it. HolDate and Country.
In my query run, the field for Country is called CountryOn.
This runs, but it does not identify a date as a holiday even though its in the table.
The matching problem is in Country.
I would like it to count the number of instances where the date AND country match, since different countries have different holidays.
lCountry is set during the input query for my OTHER public function.
Can i define a variable in a function, and have the other public function reference it?
CountryOn must be a dynamic variable, as there are queries with many different names these functions run from.
Right now I have a query for each country.
The main function references IsHoliday function.
Main Function Call
Public Function NetWorkMinutes(rdteStart As Date, rdteEnd As Date, lCountry As String) As Long
Holiday Function
Public Function IsHoliday(rdteDate As Date) As Boolean
Dim lCountry As String
On Error GoTo IsHoliday_Error
Select Case DCount("*", "Holidays", "HolDate = " & DateSQL(rdteDate) _
& "Country" = lCountry)
Case Is > 0
IsHoliday = True
Case Else
IsHoliday = False
End Select
Exit_Procedure:
On Error GoTo 0
Exit Function
IsHoliday_Error:
If Err.Number = 3078 Then
IsHoliday = False
Resume Exit_Procedure
Else
Err.Raise Err.Number, Err.Source, Err.Description
End If