Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / July 2007

Tip: Looking for answers? Try searching our database.

Calendar Control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
richard - 16 Jul 2007 15:50 GMT
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
Wolfgang Kais - 16 Jul 2007 22:41 GMT
Hello Richard.

> Hi
>
[quoted text clipped - 32 lines]
> Set cboOriginator = Nothing
> End Sub

How about something like this (not tested):

Private Sub Calendar4_Click()
cboOriginator.Value = Calendar4.Value
cboOriginator.SetFocus
Calendar4.Visible = False
If cboOriginator.Name = "Startdate" Then
   Set cboOriginator = Enddate
   Calendar4.Visible = True
   Calendar4.SetFocus
   Calendar4.Value = Date
Else
   Set cboOriginator = Nothing
   DoCmd.OpenReport....
End If
End Sub

Signature

Regards,
Wolfgang

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.