Help with pull only the Mon – Fri of previous week..

R

Raj

I have seen the question answered before but I can see to find the post ,
sorry for reposting and old question..
I need help with a date function that I can use to have my query pull the
date from the previous Monday thru Friday..
Thank in advacne
 
N

Nikos Yannacopoulos

Raj,

Try these:

Function Last_Friday()
Dim tday As Date, dday, fday As Date, i
tday = Date
dday = Weekday(tday, vbSaturday)
If dday <= 2 Then dday = dday + 7
Last_Friday = tday - dday
' Debug.Print tday, Last_Friday
End Function

Function Last_Monday()
Dim tday As Date, dday, fday As Date, i
tday = Date
dday = Weekday(tday, vbSaturday)
If dday <= 2 Then dday = dday + 7
Last_Monday = tday - dday - 4
' Debug.Print tday, Last_Monday
End Function

HTH,
Nikos
 
R

Raj

Nikos,
Thank you for the help.. I have build the modules and now the only problem i
have is i dont know how to use them in my query. This is the first time I
have used user Modules.
The way I have my query now is
Resolve_Date
Criteria: Between [Enter Monday] and [Enter Friday]
Thanks Raj
 
N

Nikos Yannacopoulos

Try this for Criteria:

Between Last_Monday() and Last_Friday()

HTH,
Nikos

Nikos,
Thank you for the help.. I have build the modules and now the only problem i
have is i dont know how to use them in my query. This is the first time I
have used user Modules.
The way I have my query now is
Resolve_Date
Criteria: Between [Enter Monday] and [Enter Friday]
Thanks Raj


:

Raj,

Try these:

Function Last_Friday()
Dim tday As Date, dday, fday As Date, i
tday = Date
dday = Weekday(tday, vbSaturday)
If dday <= 2 Then dday = dday + 7
Last_Friday = tday - dday
' Debug.Print tday, Last_Friday
End Function

Function Last_Monday()
Dim tday As Date, dday, fday As Date, i
tday = Date
dday = Weekday(tday, vbSaturday)
If dday <= 2 Then dday = dday + 7
Last_Monday = tday - dday - 4
' Debug.Print tday, Last_Monday
End Function

HTH,
Nikos
 
R

Raj

Nikos,
Thank you.. I need to and the Parenthesis..
Raj


Nikos Yannacopoulos said:
Try this for Criteria:

Between Last_Monday() and Last_Friday()

HTH,
Nikos

Nikos,
Thank you for the help.. I have build the modules and now the only problem i
have is i dont know how to use them in my query. This is the first time I
have used user Modules.
The way I have my query now is
Resolve_Date
Criteria: Between [Enter Monday] and [Enter Friday]
Thanks Raj


:

Raj,

Try these:

Function Last_Friday()
Dim tday As Date, dday, fday As Date, i
tday = Date
dday = Weekday(tday, vbSaturday)
If dday <= 2 Then dday = dday + 7
Last_Friday = tday - dday
' Debug.Print tday, Last_Friday
End Function

Function Last_Monday()
Dim tday As Date, dday, fday As Date, i
tday = Date
dday = Weekday(tday, vbSaturday)
If dday <= 2 Then dday = dday + 7
Last_Monday = tday - dday - 4
' Debug.Print tday, Last_Monday
End Function

HTH,
Nikos

Raj wrote:

I have seen the question answered before but I can see to find the post ,
sorry for reposting and old question..
I need help with a date function that I can use to have my query pull the
date from the previous Monday thru Friday..
Thank in advacne
 
Top