Solved

MSCAL.Calendar.7, setting a default

Posted on 2009-07-01
5
373 Views
Last Modified: 2013-11-28
cmdAppointment on frmMain opens frmAppointmentSet which has 2 controls:
(1) oleDate: an MSCAL.Calendar.7
(2) fraType: an Option Group with checkBoxes (3 to choose from: (100) Initial Appointment; (200) Followup Appointment; (300) Cancel

frmAppointmentSet is closed by code placed on the Click event of fraType which stores the variable values in a Public Sub module for later usage.  frmAppointmentSet Load Event runs the sub that I've attached, essentially assigning a default date to Me.oleDate.

If I do not click oleDate, the default assignment succeeds.  If I click a day date on oleDate, the newly assigned date succeeds.  However, selecting only a new year from the MSCAL's built-in dropdown without then clicking on a day-number sets Me.oleDate = 0.  Same failure on the month combo.

What events fire in these built-ins?  I'd add the default mm/dd to year drop-down selections "after update".

Thanks!

GregC
Private Sub Form_Load()

Dim intWeekday

    

    'place and size the popup form

    DoCmd.MoveSize 3.4 * 1440, 5.7 * 1440, 3.6 * 1440, 3.75 * 1440

    

    'default callback date to Monday of next week

    intWeekday = Weekday(Date, vbSunday)    'gets day number of current date

    If intWeekday >= 2 Then                 'finds relative weekday position of current date vs. Monday (e.g. Tue=-1)

        intWeekday = 2 - intWeekday         'sets offset variable used below

    End If

    

    Me.oleDate = Now() + 7 + intWeekday   'offsets current date to this Monday, advances result 7 days (next Mon)

    

End Sub

Open in new window

0
Comment
Question by:Greg-C
  • 2
  • 2
5 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24754646
I can't figure out what your ultimate question is here?

1. Setting Default Values?
2. selecting only a new year from the MSCAL's built-in dropdown without then clicking on a day-number sets Me.oleDate ?
3. Finding out what events fire on a Calendar Control?
Or something else entirely?

1. To set a default date, use the Form Load event.
3. The events that fire on a calendar control can be accessed by going into the visual Basic and selecting the calendar control from the Object list.

JeffCoachman
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 24754755
there is the NewMonth and NewYear event for the Calendar control

test this events


Private Sub oleDate_Click()
MsgBox Me.oleDate.Value
End Sub

Private Sub oleDate_NewMonth()
MsgBox Me.oleDate.Value & " NewMonth Event"

End Sub

Private Sub oleDate_NewYear()
MsgBox Me.oleDate.Value & " NewYear Event"

End Sub
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 500 total points
ID: 24754943
0
 

Author Comment

by:Greg-C
ID: 24755161
I'm looking over your responses.  I'll get back with an answer directly.
0
 

Author Closing Comment

by:Greg-C
ID: 31598765
Jeff:  I hadn't scrolled through the VB events.  My question was really about Calendar Condrol and your answer was right on.
Capricor1:  Thanks for the code and links.  I'm absorbing all of this.
Split the points and each take 100% of my thanks!

GregC
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now