subform above all

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have a form which includes a subform and an activeX control (of a
celendar). the activeX control is usually not visible to the user, and is
placed over the subform (but is not part of the subform, it's part of the
fahter form). When the user presses a button the control is supposed to be
made visible, but since it's placed on the subform is doesn't actually appear
on the screen (the subform appears above it). Is there a way to make it
appear above the subform, when visible?

thank you,
 
Have you consider creating the calander in a seperate form, when you open it
as pop up form, that return the date selected, so you can use it everywhere,
without creating it everytime.
 
thanks, sounds like a good idea.
But how do I make it to return the date to the control I want?
Let's say I have on my form 4 controls which represent different dates. Neer
each control I have a button which pops up the another form with a calendar
activeX control (and, according to your suggestion they all actually pop up
the same form). How do I make the date returned be placed in the right
control? And how do I make the calendar form close once a date has been
chosen (or once it looses focus)?
thanks,
 
I have create a button next to each text box that contain a date, on the
Onclick event I ran that code

Me.FieldName = OpenCalControl(Me.FieldName)
=================================
The OpenCal Function is decalred in a Module, create a Global variable in
the module declaration

Global NewDate As Variant
Global OrgDate As Variant

Function OpenCalControl(GetDate As Variant)
NewDate = Null
OrgDate = NZ(GetDate, Date)
DoCmd.OpenForm "CalendarControl", , , , , acDialog, OrgDate
OpenCalControl = NZ(NewDate, GetDate) 'will return the prev date if no
date selected
End Function
=====================================
On the On Load event of the form with the calander control, assign the value
of
Me.OpenArgs to the control
=====================================
When you close the form with calander assign the date value from the
calander to the NewDate
=====================================
I didn't try this code, but I hope it will work
The next time you want to use it, you just create a button next to a text
box, and run the line

Me.FieldName = OpenCalControl(Me.FieldName)
With a change of the field name
 
great! Thanks!
--
dshemesh


Ofer said:
I have create a button next to each text box that contain a date, on the
Onclick event I ran that code

Me.FieldName = OpenCalControl(Me.FieldName)
=================================
The OpenCal Function is decalred in a Module, create a Global variable in
the module declaration

Global NewDate As Variant
Global OrgDate As Variant

Function OpenCalControl(GetDate As Variant)
NewDate = Null
OrgDate = NZ(GetDate, Date)
DoCmd.OpenForm "CalendarControl", , , , , acDialog, OrgDate
OpenCalControl = NZ(NewDate, GetDate) 'will return the prev date if no
date selected
End Function
=====================================
On the On Load event of the form with the calander control, assign the value
of
Me.OpenArgs to the control
=====================================
When you close the form with calander assign the date value from the
calander to the NewDate
=====================================
I didn't try this code, but I hope it will work
The next time you want to use it, you just create a button next to a text
box, and run the line

Me.FieldName = OpenCalControl(Me.FieldName)
With a change of the field name
 
just one more question:
I want the calendarControl form to open near the button which activated it.
I tried sending the celendarcontrol form the top and left properties of the
button as arguments. but I got a bit stuck, since the only way I know to move
the calendarcontrol form is with doCmd.MoveSize which recieves right and top
instead of left and top.
Is there anyway to access the top and left properties of the form directly
(assuming a form actually has these properties)?
thanks
 
On the OnLoad event of the Calander control you can ran the MoveSize command,
using two other parameters that you can pass with the function, which are the
location of the button, and then play a bit with the numbers until you get
the desire location with the size of the form

DoCmd.MoveSize GlbLeft, GlbHight
--
If I answered you question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
Back
Top