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.
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