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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the ActiveX Calendar

Status
Not open for further replies.

dpimental

Programmer
Jul 23, 2002
535
US
All, I am using the ActiveX Calendar 9.0. I have one "CALENDAR" form. I have several controls on a few different forms that I want to call the calendar form from.

I am using an image and an onClick event to call the calendar form.

But I need to send the Calendar the form I am calling from and the control I am calling from, so the calendar knows which control on which form to update.

I have tried making a Public Function in the Calendar form as well as a public function in a global module. I can't seem to get the calendar form to recognize the form control to update it?



David Pimental
(US, Oh)
 
How are you bringing up the calendar form?

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
I have a date field and an image next to it. It's a small picture of a calendar. When you click on the image, it pops up the Calendar form.

Could I use public variables to house the name of the form and control I am using? And set them each time I call the calendar form?

David Pimental
(US, Oh)
 
Sorry, I meant more along the lines of the code you are using. What is in the click event of your image?

If you are using the variables, one thing I would do is make your calendar form modal so that you can't switch forms or anything while it is up.

Here is a link on the subject:
Hope this helps,

Alex

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
I'm just doing a ...
Code:
DoCmd.OpenForm "My Form"

What I am trying to do is have the form I open know what form I opened it from and what control it needs to insert the date into.

David Pimental
(US, Oh)
 
How many forms can possibly call this calendar form?

I think you might want to just code a select case statement on the calendar form that assigns a value to a certain text box (dependent on global variable contents).

That way, if you update the global var before the form opens, it knows where to point.

Am I making sense?

Hope this helps,

Alex

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
I ended up writing a function on the calendar form that took an integer, and then did a select case, based on the integer to determine which control to update.

Thanks for the help!

David Pimental
(US, Oh)
 
Glad you got it working :)

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
How are ya dpimental . . .

You can use the last arguement of DoCmd.OpenForm called [blue]OpenArgs[/blue].

If the formname is frmTest and the controlname to receive the date is ctlTest then:
Code:
[blue]   DoCmd.OpenForm "My Form", , , , , , "frmTest;ctlTest"[/blue]
sends the names to the calendar. Then in the AfterUpdate event of the calendar:
Code:
[blue]   Dim Ary
   
   Ary = Split(Me.OpenArgs, ";")
   
   Forms(Ary(0))(Ary(1)) = Me!CalendarControlName[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
That is a great idea. However, the calendar form that I am opening is fine. The calendar it self needs to be able to reference the date field in the form I started with, in order to reset the date, based on the one I select in the calendar. Here is the sequence.

1. I open "DataForm1"

2. I click on the image next to the date field.

3. The "CALENDAR" form pops up.

4. I select a new date fromt the calendar.

5. The Calendar closes and inserts the date in my field on the "DataForm1".

So, I like your reference to the form and field; but I need to turn them into actual "Control" and actual "Form" objects in order for the calendar to reference them.

David Pimental
(US, Oh)
 
dpimental . . .

Forms(Ary(0))(Ary(1)) translates to:
Forms("frmTest")("ctlTest") which is the same as:
Forms!frmTest!ctlTest

Is this not an object?

The idea is from any form all you have to do is send the forms name and the date control name thru openargs.

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
That's what I need. I will give it a shot and let you know how it goes. Thanks!

David Pimental
(US, Oh)
 
Whenever I need a calendar, I use Allen Browne's Access calendar. I got into alot of trouble messing with the ActiveX control once I deployed my app to other desktops. Allen's works fabulous without the hassle.



Diana
VBA Princess
-- I'm hoping to grow up to be a Goddess!
 
VBA Princess (Are you really a princess?), it looks good. I will take a look at it. Thanks. Thanks again everyone for all your help.

David Pimental
(US, Oh)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top