G
Guest
I'm very new at this (1 week old).
I've created a timesheet and I have two date fields; one is 'Week Beginning'
the other is 'Today's Date'. I also have added a pop-up calendar to select
'Todays' Date'. I'm having trouble doing the same for 'Week Beginning'. So, I
would like to know if it's possible when I choose today's date that my week
beginning automatically place Monday's date in the appropriate field? Here is
my current code that I got from 'Tech on the Net':
Private Sub cmdCancel_Click()
'Cancel and close form
DoCmd.Close
End Sub
Private Sub cmdSet_Click()
'Set date in source object
Select Case GCalSource
'Assign the calendar value to the DATE field on the TimeSheet
Case "DATE"
Form_Timesheet.Date = CalObject.Value
End Select
'close form
DoCmd.Close acForm, "Calendar"
End Sub
Private Sub Form_Load()
'This code must be placed in the Load event to work properly
'DO NOT move to the Open event
CalObject.Value = GCalDate
DoCmd.RepaintObject acForm, "Calendar"
End Sub
I was wondering if I could add a line below the Form_Timesheet.Date =
CalObject.Value such that it would put the previous Monday's date regardless
of today's date in the week beginning field? and what it would be?
Something like:
Form_Timesheet.Week = CalObject.Value - 'number of days till previous Monday'
I've created a timesheet and I have two date fields; one is 'Week Beginning'
the other is 'Today's Date'. I also have added a pop-up calendar to select
'Todays' Date'. I'm having trouble doing the same for 'Week Beginning'. So, I
would like to know if it's possible when I choose today's date that my week
beginning automatically place Monday's date in the appropriate field? Here is
my current code that I got from 'Tech on the Net':
Private Sub cmdCancel_Click()
'Cancel and close form
DoCmd.Close
End Sub
Private Sub cmdSet_Click()
'Set date in source object
Select Case GCalSource
'Assign the calendar value to the DATE field on the TimeSheet
Case "DATE"
Form_Timesheet.Date = CalObject.Value
End Select
'close form
DoCmd.Close acForm, "Calendar"
End Sub
Private Sub Form_Load()
'This code must be placed in the Load event to work properly
'DO NOT move to the Open event
CalObject.Value = GCalDate
DoCmd.RepaintObject acForm, "Calendar"
End Sub
I was wondering if I could add a line below the Form_Timesheet.Date =
CalObject.Value such that it would put the previous Monday's date regardless
of today's date in the week beginning field? and what it would be?
Something like:
Form_Timesheet.Week = CalObject.Value - 'number of days till previous Monday'