P
PeterM
I have a home-grown calendar form. When we started it was all East Coast
pepole but recently we've added people all over the US in all 4 time zones.
I'm planning on adding a combobox where the user selects their default time
zone. When a user edits a calendar record I plan on adding code to the form
where I adjust the start and end times of the entry based on the time zone
combobox. I'm using the idea that if I can intervene after the row is read
and before it's placed onto the form to adjust the time. Then I'll adjust
the time before the record is written (either inserted or updated). Once the
user saves the changes the form automatically closes so I don't need to
readjust the times again after an insert or update on the form.
Here's the code I'm planning on using right before I write the record into
the table:
Select Case Forms!Calendar!time_zone
Case "Eastern"
Case "Central (-1)"
Me.calendar_start = DateAdd("h", 1, Me.calendar_start)
Me.calendar_end = DateAdd("h", 1, Me.calendar_end)
Case "Mountain (-2)"
Me.calendar_start = DateAdd("h", 2, Me.calendar_start)
Me.calendar_end = DateAdd("h", 2, Me.calendar_end)
Case "Pacific (-3)"
Me.calendar_start = DateAdd("h", 3, Me.calendar_start)
Me.calendar_end = DateAdd("h", 3, Me.calendar_end)
End Select
The code after the read and before populating the form is:
Select Case Forms!Calendar!time_zone
Case "Eastern"
Case "Central (-1)"
Me.calendar_start = DateAdd("h", -1, Me.calendar_start)
Me.calendar_end = DateAdd("h", -1, Me.calendar_end)
Case "Mountain (-2)"
Me.calendar_start = DateAdd("h", -2, Me.calendar_start)
Me.calendar_end = DateAdd("h", -2, Me.calendar_end)
Case "Pacific (-3)"
Me.calendar_start = DateAdd("h", -3, Me.calendar_start)
Me.calendar_end = DateAdd("h", -3, Me.calendar_end)
End Select
I think this logic should work if I can determine where to intervene with
this code.
I can't figure out which events on the form that I need to use. Can anyone
suggest all of the events I'd need to write vba code to do this?
Thanks in advance for your help!
pepole but recently we've added people all over the US in all 4 time zones.
I'm planning on adding a combobox where the user selects their default time
zone. When a user edits a calendar record I plan on adding code to the form
where I adjust the start and end times of the entry based on the time zone
combobox. I'm using the idea that if I can intervene after the row is read
and before it's placed onto the form to adjust the time. Then I'll adjust
the time before the record is written (either inserted or updated). Once the
user saves the changes the form automatically closes so I don't need to
readjust the times again after an insert or update on the form.
Here's the code I'm planning on using right before I write the record into
the table:
Select Case Forms!Calendar!time_zone
Case "Eastern"
Case "Central (-1)"
Me.calendar_start = DateAdd("h", 1, Me.calendar_start)
Me.calendar_end = DateAdd("h", 1, Me.calendar_end)
Case "Mountain (-2)"
Me.calendar_start = DateAdd("h", 2, Me.calendar_start)
Me.calendar_end = DateAdd("h", 2, Me.calendar_end)
Case "Pacific (-3)"
Me.calendar_start = DateAdd("h", 3, Me.calendar_start)
Me.calendar_end = DateAdd("h", 3, Me.calendar_end)
End Select
The code after the read and before populating the form is:
Select Case Forms!Calendar!time_zone
Case "Eastern"
Case "Central (-1)"
Me.calendar_start = DateAdd("h", -1, Me.calendar_start)
Me.calendar_end = DateAdd("h", -1, Me.calendar_end)
Case "Mountain (-2)"
Me.calendar_start = DateAdd("h", -2, Me.calendar_start)
Me.calendar_end = DateAdd("h", -2, Me.calendar_end)
Case "Pacific (-3)"
Me.calendar_start = DateAdd("h", -3, Me.calendar_start)
Me.calendar_end = DateAdd("h", -3, Me.calendar_end)
End Select
I think this logic should work if I can determine where to intervene with
this code.
I can't figure out which events on the form that I need to use. Can anyone
suggest all of the events I'd need to write vba code to do this?
Thanks in advance for your help!