filtering a subform to display current week

2e1fmo

New member
Local time
Today, 05:02
Joined
Mar 7, 2002
Messages
9
Hi there,

I have a form with a subform displaying 3 fields: date, timestart and timefinish.

This is basically a clocking in and out form. What I am trying to achieve (and have got no where with!) is to have a command button, which the user clicks and filters the data in the subform to display the dates for the current week, starting on the monday thru to the friday. The filter would use the field date (which is automatically set to the current date when the staff member clocks in)

Any code would be much appreciated as I am still fairly new to VBA.

many thanks in advance
 
DatePart("w",[StartDate]) will give you the numerical value of the day of the week. Monday is 2, Friday is 6. DatePart("ww",[StartDate]) will give you the week of the year (unfortunately I'm not sure how it handles the 1/52 wraparound).

Actually thinking a little deeper, something like DateDiff("d",DatePart("w",Now()-2),Now()) will give you Monday's date and DateDiff("d",-4,[PreviousExpressionValue]) will give you Friday for any week in existence.

See if you can't plug those into your criteria and make it work.

David R


[This message has been edited by David R (edited 04-05-2002).]
 

Users who are viewing this thread

Back
Top Bottom