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 / General 2 / September 2007

Tip: Looking for answers? Try searching our database.

Calendar Month

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ReportSmith - 13 Sep 2007 19:40 GMT
Simple question (I hope):

I placed a Calendar control on a report (to make it look spiffy).  Now I
would like to print the report with the Calendar heading based on a value the
user inputs.

ie:  For October 2007 - print the Calendar with "October" in the heading and
the drop-down box next to the heading and "2007" in the drop-down box next to
the month drop-down.

I thought it would work if I put in the following code:

Private Sub Report_Open(Cancel As Integer)
   MoNum = InputBox("Enter the month # to print")
   Cal1.Month = MoNum                'also tried "Cal1.Month.Value" &
"Cal1.Value"
End Sub

But it doesn't.  Any pointers would be greatly appreciated.
jmonty - 13 Sep 2007 20:10 GMT
Cal1.Month should work....however that property is an Integer Value.
The Inputbox returns a String.    
In other words: 12 does not equal "12"
You must compare apples to apples....not apples to oranges.

3 suggestions:
Either
1. Convert the Cal1.Month to a string before you do a compare. See Cstr()
function
OR
2. Convert the Inputbox return value to an integer before you do a compare.
See CInt() function
OR
3. Define the Inputbox's return value (MoNum) as Variant.

> Simple question (I hope):
>
[quoted text clipped - 15 lines]
>
> But it doesn't.  Any pointers would be greatly appreciated.
ReportSmith - 13 Sep 2007 21:28 GMT
Thanks for the suggestions.  I looked at the CInt function - understood it -
but wasn't able to make it work.  So, I did it another way.

I needed the calendar to show up with the Month heading only (no data, etc)
for a draft printout to be filled in manually (and then transferred into the
database - that part is done).  

So, I just put it on a form instead of a report and let the user select the
month (and even date, if they want), since it will not really be used within
the db - only for manual scribbling.

Thanks again.

> Cal1.Month should work....however that property is an Integer Value.
> The Inputbox returns a String.    
[quoted text clipped - 30 lines]
> >
> > But it doesn't.  Any pointers would be greatly appreciated.
CompGeek78 - 13 Sep 2007 22:27 GMT
On Sep 13, 2:28 pm, ReportSmith
<ReportSm...@discussions.microsoft.com> wrote:
> Thanks for the suggestions.  I looked at the CInt function - understood it -
> but wasn't able to make it work.  So, I did it another way.
[quoted text clipped - 43 lines]
>
> > > But it doesn't.  Any pointers would be greatly appreciated.

You could use something along these lines:

   Dim intMonth As Integer
   intMonth = InputBox("Please enter a month number:")
   Calendar0.Value = DateSerial(Year(Now()), intMonth, 1)

This simply sets the calendar control to the current year, whatever
month they typed in, with the first day of that month selected. Simply
adjust the values in the dateserial function to adjust what date gets
picked.

Keven Denen
Exalen Training, LLC
 
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.