Calendar Control

MikeAngelastro

Registered User.
Local time
Today, 02:49
Joined
Mar 3, 2000
Messages
254
Hi,

Does anyone have or know how I could get any good examples of using the calendar control in Access 97?

Also, is it possible to have one form containing the control, that could be accessed by any other form in the application that needs a user selected date? Or is it necessary to place it on all these forms?

Thanks,

Mike
 
Check out the "solutions" database for examples of using calendar control, you can use one calendar for several forms using an If IsLoaded statement.
 
Where do I find the IsLoaded function? It is not in my list of built in Access functions?
 
The IsLoaded function is a sample Function procedure included with the Northwind sample database, and not a built-in Visual Basic for Applications function. To use the IsLoaded function in your database, first open the Northwind sample database, then copy the function, and paste it in a module in your database.
(Above copied from Help File)

Michael Abrams
 
Hi Michael,

I used the IsLoaded function from the Northwind sample database. But I can't get it to work right. I use the function below to get the date but I never get a msgbox to pop up. There must be a timing issue I'm not handling.

I have two loops in the function below. The first loop is to ensure that the Calendar form, frmCal, does indeed get loaded first. The second loop is supposed to take place after frmCal loads. As frmCal unloads, it sets a global variable, NewDate, to the date selected by the calendar control. This variable does does get set because I varify that. But the text box, txtdate, never receives the value.

What I find frustrating in this is that the calendar control doesn't have a click event like the one I'm used to in VB6. Do you have any ideas?

Private Sub cmdGetDate_Click()
On Error GoTo HandleError

DoCmd.OpenForm "frmCal", acNormal

ContinueA:
DoEvents
If Not IsLoaded("Forms!frmCal") Then GoTo ContinueA
MsgBox "I'm finally loaded!"

ContinueB:
DoEvents
If IsLoaded("Forms!frmCal") Then GoTo ContinueB
MsgBox "I'm finally unloaded!"
Me!txtDate.SetFocus
txtDate = NewDate 'NewDate is global

ExitSub:
Exit Sub

HandleError:
MsgBox Err.Description
Resume ExitSub
End Sub
 

Users who are viewing this thread

Back
Top Bottom