Full Version: Single Calendar form on multiple forms
UtterAccess Forums > Microsoft® Access > Access Forms
I have a calendar form with an ActiveX control on it. When the user clicks the date, then the "Insert Date" command button, it enters the date into the form.
However, its only working for the original form that I developed it for use on. It won't work with the other forms that I'm trying to get the same form to be used.
The code behind the "Insert Date" button is:
Forms!frmViewInd.Controls (Me.Calendar3.Tag) = Me.Calendar3.Value
Forms!frmViewInd.Controls (Me.Calendar3.Tag) = SetFocus
Me.Calendar3.Tag = ""
DoCmd.Close acForm, "frmCalendar"

Any ideas on what I can switch to make it put the date in the form WITHOUT having to copy the calendar form like 10x?
Hello Brother,
orms!frmViewInd is referring to the original form. You would have to do something where you code refers to the form currently open, like ActiveForm or something. I will go see if I can find how to refer to the current active form. The other thing would be how to set the date in the right control since each control on your different forms will be named differently, so maybe if the tag for each date control was soemthing like CalendarDate or something, you could use the Tag to set the date in the right control.
Hope that helps some...
You could simply pass an parrameter to the calendar form to tell it what the active form is. Like:
DoCmd.OpenForm "frmCalendar", , , , , , "frmCustomer"
When in the the frmCalendar form you can check the Me.OpenArgs value to see what form called it.
Thanks brother...
will look at this, if I don't have to redo this entire DB from scratch (AGAIN!) for like the 10th time!
No problem..Alan's suggestion is a good idea as well...
Hope you find what you need!!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.