Date Functions

  • Thread starter Thread starter Allison
  • Start date Start date
A

Allison

Does anybody know how to use wildcards with dates? I am
trying to write a piece of code that will return
join_date is any time in January quarter = Q1 etc.
My join_date is formated mm/dd/yy. Any suggestions would
be greatly appreciated!
 
Allison said:
Does anybody know how to use wildcards with dates? I am
trying to write a piece of code that will return
join_date is any time in January quarter = Q1 etc.
My join_date is formated mm/dd/yy. Any suggestions would
be greatly appreciated!

The format doesn't really matter. It's the data type that
is important, how it's displayed only matters to people when
the look at it.

An easy way to determine the quarter that a date falls into,
is to use the DatePart function, DatePart("q", joindate)
 
Create the following function (this function was written to reflect Fed.
Gov. Quarters so change the values to correspond with your quarters)
-------------------------------------------------------
Function GetQuarter(DateToTest As String) As String
Select Case MONTH(DateToTest)
Case 10, 11, 12
GetQuarter = "Q1"
Case 1, 2, 3
GetQuarter = "Q2"
Case 4, 5, 6
GetQuarter = "Q3"
Case 7, 8, 9
GetQuarter = "Q4"
End Select
End Function
----------------------------------------------------------
In your query use the following as a field value
GetQuarter([join_date])
or in your code you can use the following
if GetQuarter(Join_date) = "Q1" then
.........
end if
 
I am
trying to write a piece of code that will return
join_date is any time in January quarter = Q1 etc.

If Format(JoinDate,"q") = "1" Then
' it is

Else
' it isn't

End If

HTH


Tim F
 
Back
Top