Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

feed calendar control value to text box on other form 1

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
Using Access 2000

I have a small pop-up form, called frmCalendar. On it is an ActiveX control called MyCal (this is the built-in Microsoft Access calendar control).

It is opened from another form called frmAttendance.

What I want to have happen is that selecting a date in the control MyCal closes frmCalendar.

Ultimately, of course, I want the date clicked on to be fed back into a text box called txtMeetingDate in frmAttendance.

Now, I can get all of that to happen by manually closing frmCalendar...but I want that to happen automatically upon selecting a date in MyCal.

Thanks.

Tom

 
If you're using the Calendar Control 8.0 then the date selection events are a bit hit and miss (though more miss if I'm honest!).

I'd do it on the Caendar's DblClick event, pass the value how you are doing now and then use a DoCmd.Close to close your form, something like:
Code:
Private Sub CalSelDate_DblClick()
' your code to pass the value here, I've just put it to a msgbox
MsgBox CalSelDate.Value
DoCmd.Close , frmCalendar ' close the form
End Sub
Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
How are ya THWatson . . .
Code:
[blue]   Forms!frmAttendance!txtMeetingDate = Me!MyCal
   DoCmd.Close acForm, "frmCalendar", acSaveNo[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
HarleyQuinn
Access (2003) calls it Calendar Control 11. I see in the Properties it is called MSCAL.Calendar.7

However, unless I just can't find it, there is neither a DoubleClick or a Click event for the calendar control. Its only events are Updated, Enter, Exit, GotFocus and LostFocus.

Putting the code you suggest on the Updated event does nothing. Putting the code you suggest on the form itself does nothing.

So I'm a little at sea as to what to do with your code.

And I know about some of the idiosyncracies of the ActiveX control - I had it embedded in frmAttendance and had periodic problems. That's why I tried a few other calendars. The AceMan1 pointed me to one that was reasonable, but I thought if perhaps I left the calendar control on its own separate form and opened it from frmAttenance it would cooperate better...and I like the design of the Microsoft one somewhat better.

TheAceMan1
The code you offered is what I have on the frmCalendar's Close event, and that works...but I'm still trying to get that to happen automatically upon clicking a date in the calendar control.

Thanks.

Tom

 
Tom,

If you go into the code window, there will be two drop down boxes above the code. Change the left one to your calendar control and then drop the right hand one down, it will show you all the events that the control can use, DblClick should (it was how I did it on mine) be in there for you.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Harley
Well, I see the two drop down boxes to which you refer. You mean, I gather, in the VBE editor window? The left box starts out with "General" and then has the various controls listed under that. The right one says "Declarations."

But MyCal doesn't show up in the left box??

Tom
 
Tom,

Yeah, that's exactly where I meant. Do the all the other controls for frmCalendar show in the left hand box?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Harley
Sorry...found it!

And it works!

Thanks.

When I couldn't find it previously, I tried entering the code manually, but that didn't work.

But it's good now.

Thanks again!

Tom
 
Glad to help [smile]

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Is there any reason the Calendar control would open to display Sunday-Saturday on one machine, and Saturday-Friday on another?

Mine displays Sunday-Saturday, which is the way I want it. The FirstDay property is set to Sun.

On the user's computer, the Calendar opens displaying Saturday-Friday.

Does the Calendar follow system settings, irrespective of the Property setting in the Calendar control itself?

I know that the Microsoft ActiveX Calendar control has idiosyncracies, but this one doesn't quite make sense.

Tom
 
Seems like this might be a known fault, maybe this will help.

Cheers

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Well, I'll be. Ain't that interestin'

Thanks.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top