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

Linking Calendar (activex) control,

Status
Not open for further replies.

112nokia

Technical User
Nov 21, 2006
12
YU
Hi
I have created a Calendar form, using the toolbox active x control. I am now trying to link the date that I press in the calendar form to display in a date field in "another" form. How can I achieve this. I am reading the Access bible, it says by using its Control sourse property, but I can not do it.

Please help,

Thanks,
 
How are ya 112nokia . . .

In the [blue]On Updated[/blue] event of the Calendar Control:
Code:
[blue]   Me![purple][b][i]Textboxname[/i][/b][/purple] = Me![purple][b][i]CalendarControlName[/i][/b][/purple][/blue]

Calvin.gif
See Ya! . . . . . .
 
The AceMan is correct as usual.
Something else you may want to consider is assigning the date to a global variable and then assign the variable to a function. That way you can use the value in a query, if need be.

-Hovercraft
 
112nokia said:
[blue] . . . trying to link the date that I press in the calendar form to display in a date field in [purple]"another" form[/purple].[/blue]
Sorry about the misread. Correcting would be:
Code:
[blue]   Forms![purple][b][i]FormName[/i][/b][/purple]![purple][b][i]Textboxname[/i][/b][/purple] = Me![blue][b][i]CalendarControlName[/i][/b][/blue][/blue]

Calvin.gif
See Ya! . . . . . .
 
112nokia . . .

. . . and [blue]hovercraft[/blue] is correct, the alternate form has to be open for the transfer to occur!

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hello,

I tried Forms!FTR!VD=Me!calendar0, under the event tab of properties under the calendar form. Its not working?

FTR is the name of the form, VD is the name of the text box. Maybe the right side of the equaation in the syntax is wrong??! I have tried both forms engaged, also.

What am I doing wrong?
 
You would put the Aceman's code example in the "AfterUpdate" event. If you're useing Cal Control 10 you won't see it in the events list in the properties (at least I didn't see it there).
In case you don't know how to get to the code builder;
1) Right-Click on the cal control.
2) Select "Build Event"
3) Choose "Code Builder" from the "Choose Builder" pop-up.
or... just hit the button on the toolbar the says "Code".

Once there just select the control from the Objects drop-down box on the left and choose "AfterUpdate" in the procedures list.

and then just make sure both forms are open (unless you go with a global variable.).
 
Hi

this is what I have on the code

Private Sub Calendar3_Updated(Code As Integer)
Forms!FTR!VD = Me!Calendar3
End Sub

this time I have place both the calendar and the text field VD on the same form FTR.

It still not working. I am trying to make this database more user friendly. It has a structure only worth 15 MB.
Please help!

Many thanks is advance.
 
112nokia . . .
How are we to get it to work if you keep making changes! [surprise]
Code:
[blue]Private Sub Calendar3_Updated(Code As Integer)
   [purple][b]Me!VD[/b][/purple] = Me!Calendar3
End Sub[/blue]

Double-check the [blue]Name[/blue] property of the controls!

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

Private Sub Calendar3_AfterUpdate()
Me!VD = Me!Calendar3
End Sub

 
hovercraft . . .

Thanks for the correction. i meant to use AfterUpdate. I Believe OnUpdate fires when you write to the activex control . . .

Calvin.gif
See Ya! . . . . . .
 
I tried to enter the code to the calendar properties on "updated", and & or,also on the VD text box. But its not working.


The name of the calendar is calendar3. Both the VD text box and FTR reside on the same form.
 
112nokia . . .

If you read my prior post you'd know I thanked [blue]hovercraft[/blue] for using the correct event . . . [purple]AfterUpdate![/purple]

Now . . . are you putting the code on the [blue]event line[/blue] or in the event where it belongs?
[ol][li]In [blue]form design view[/blue] click the [blue]code[/blue] toolbar button
Code.BMP
.[/li]
[li]In the [blue]VBE window[/blue] select [blue]Calendar3[/blue] from the left combobox. Then from the right combobox select [blue]AfterUpdate[/blue][/li]
[li]Copy/paste the following line to the event:
Code:
[blue]   Me!VD = Me!Calendar3[/blue]
When your done the event should look like the following:
Code:
[blue]Private Sub Calendar3_AfterUpdate()
   Me!VD = Me!Calendar3
End Sub[/blue]
[/li]
[li]Remove all of the [blue]Updated[/blue] event![/li]
[li]Hit Alt + Q to return to design view. Save the form and do your testing![/li][/ol]
BTW:
112nokia said:
[blue] . . . this time I have place both the calendar and the text field VD [purple]on the same form FTR[/purple].

. . . The name of the calendar is calendar3. Both the VD text box and [purple]FTR reside on the same form[/purple].[/blue]
Did you mean to say the calendar & VD are on the same form?

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top