I couldn't find a way to return the month when you change it in the combobox
so maybe this will work for you ---
You used "Calendar" as the name of your control so I will do the same.
1. Go to Calendar in design view, open properties and set
ShowDateSelections and ShowTitle to No. This will reduce the top border of
the calendar control.
2. The Year combobox in the calendar control contains the years 1900 to
2100. Create a table with the numbers from 1900 to 2100 then create a
combobox named CbxYear based on this table. Position the year combobox just
above the calendar control.
3. Create a new month combobox named CbxMonth and use a value list for the
rowsource. The value list must look like:
1,Jan;2,Feb;3,Mar etc. Note the comma after the number and semi-colon after
the month. Set the BoundColumn property to 1, ColumnCount to 2 and
ColumnWidth to 0;.75. Position this combobox directly above the calendar
control.
4. Create a label named LblMonthYear wide enough to hold "September 2005"
and position the label just above the calendar control.
5. Your calendar control should now almost look like the original calendar
control.
6. Put the following code in the Open event of your form that contains the
calendar:
Me!CbxMonth = Month(Date())
Me!CbxYear = Year(Date()
Me!LblMonthYear.Caption = Me!CbxMonth.Column(1) & ", " & Me!CbxYear
Me!Calendar.Value = Date()
Me!CalendarDay = 0
7. Put the following code in the AfterUpdate event of CbxYear:
Me!LblMonthYear.Caption = Me!CbxMonth.Column(1) & ", " & Me!CbxYear
Me!Calendar.Value = DateSerial(Me!CbxYear,Me!CbxMonth,1)
Me!CalendarDay = 0
8. Put the following code in the AfterUpdate event of CbxMonth:
Me!LblMonthYear.Caption = Me!CbxMonth.Column(1) & ", " & Me!CbxYear
Me!Calendar.Value = DateSerial(Me!CbxYear,Me!CbxMonth,1)
Me!CalendarDay = 0
**Me!NewMonth = Me!CbxMonth.Column(1)
** This line of code returns the new month for the calendar. I don't know
how you use it relative to your subform so you may need to change this line
of code.
The above sets your calendar to the current date when your form with the
calendar opens. Selecting a Year or Month in the comboboxes resets your
calendar and the label to the selected Year and Month. "1" is used in the
DateSerial expressions just because that expression needs a number for the
day. Me!CalendarDay = 0 immediately removes "1" from being selected so that
your calendar looks like you now need to select a day.
You will be able to now select a new month and execute whatever code you
need at ** before needing to select a day.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com
If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee. Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Need appointment scheduling? Need
room reservations scheduling? Need employee work scheduling? Contact me!