R
richard
Hi
My boss wants to run a report using the calendar control, as it takes him
too long to type the numbers in to a paramter prompt for the query.
I have designed a form which has two fields
Startdate
Enddate
I wish to fully automate the procedure so that my boss only has to click two
dates for the report to run and also by using only one calendar control
within the form.
Below is the code so far, however I am struggling to find a way to make the
code work for updating the Enddate field. Can someone please advise which
event would work for triggering the second part of the code needed
Code to setting the value for Startdate, as you can see I have used the
Form_Open event to start the first bit of code offf, however I am struggling
for the event to trigger the next bit off. I know it will be simple and I
will kick my self later, but please help
Option Compare Database
Dim cboOriginator As ComboBox
Private Sub Form_Open(Cancel As Integer)
Set cboOriginator = Startdate
Calendar4.Visible = True
Calendar4.SetFocus
Calendar4.Value = Date
End Sub
Private Sub Calendar4_Click()
cboOriginator.Value = Calendar4.Value
cboOriginator.SetFocus
Calendar4.Visible = False
Set cboOriginator = Nothing
End Sub
My boss wants to run a report using the calendar control, as it takes him
too long to type the numbers in to a paramter prompt for the query.
I have designed a form which has two fields
Startdate
Enddate
I wish to fully automate the procedure so that my boss only has to click two
dates for the report to run and also by using only one calendar control
within the form.
Below is the code so far, however I am struggling to find a way to make the
code work for updating the Enddate field. Can someone please advise which
event would work for triggering the second part of the code needed
Code to setting the value for Startdate, as you can see I have used the
Form_Open event to start the first bit of code offf, however I am struggling
for the event to trigger the next bit off. I know it will be simple and I
will kick my self later, but please help
Option Compare Database
Dim cboOriginator As ComboBox
Private Sub Form_Open(Cancel As Integer)
Set cboOriginator = Startdate
Calendar4.Visible = True
Calendar4.SetFocus
Calendar4.Value = Date
End Sub
Private Sub Calendar4_Click()
cboOriginator.Value = Calendar4.Value
cboOriginator.SetFocus
Calendar4.Visible = False
Set cboOriginator = Nothing
End Sub