Popup Calendar Form, Multiple Date Textboxes

M

Misc

I have a problem concerning the ActiveX Calendar Control (Access 97/2002).

I have a form (Orders) with multiple date fields. Next to each date
field/textbox there is a button/command which will popup/trigger an another
form (Calendar). This second form has a ActiveX Calendar Control in it.

The problem is that I need the second form (Calendar) to then allow the user
to select a date but also to pass the date value back to the calling form
(Orders) and to a specific date textbox.

I need to avoid using the ActiveX Calendar Control in the same form (Orders)
as the date textboxes, that is, the Calendar control needs to be in another
form and pass the date value back. Also, there will be more forms added
soon, which will also require using the Calendar Form, so the Calendar form
should not have anything hard-coded into it referring directly/only to the
Orders form.


Orders Form
====================

Private Sub cmdDate1_Click()
'Popup Calendar Form and allow user to select date, possibly send Calendar
form a default date to start with
'When the Calendar Form is displayed the user should not be able to access
any other form but the Calendar Form

'When user is finished with Calendar form, change txtDate1.value to the
value of the ActiveX Calendar Control
'and close Calendar form
End Sub


Private Sub cmdDate2_Click()
'Popup Calendar Form and allow user to select date, possibly send Calendar
form a default date to start with
'When the Calendar Form is displayed the user should not be able to access
any other form but the Calendar Form

'When user is finished with Calendar form, change txtDate2.value to the
value of the ActiveX Calendar Control
'and close Calendar form
End Sub



Private Sub cmdDate3_Click()
'Popup Calendar Form and allow user to select date, possibly send Calendar
form a default date to start with
'When the Calendar Form is displayed the user should not be able to access
any other form but the Calendar Form

'When user is finished with Calendar form, change txtDate3.value to the
value of the ActiveX Calendar Control
'and close Calendar form
End Sub



Customer Form (Added at a later date)
====================

Private Sub cmdDOB_Click()
'Popup Calendar Form and allow user to select date, possibly send Calendar
form a default date to start with
'When the Calendar Form is displayed the user should not be able to access
any other form but the Calendar Form

'When user is finished with Calendar form, change txtDOB.value to the
value of the ActiveX Calendar Control
'and close Calendar form
End Sub



Calendar Form
======================

Private Sub Form_Unload (Finished or Updated etc)
'Send value of calendar control to specific date textbox in Orders Form
'Close Calendar form
End Sub


I have looked for a solution but to no success. Can someone help me or
point me in the right direction?

Thank you in advance
 
J

Jeff Conrad

Misc said:
I have looked for a solution but to no success. Can someone help me or
point me in the right direction?

Yes, don't use the ActiveX Calendar Control!
Use Sensei Stephen Lebans Calendar instead:

http://www.lebans.com/monthcalendar.htm

Instructions are included on the site.

No versioning issues, users can customize it to their liking, very easy to set up, you don't have to
worry about the complexity of your current situation, etc.
 
J

JRF

In the past I have been successful with establishing a global variable and
setting it to a default value. Depending on the button or event that
triggers your calendar control, a value is assigned to the global variable.
The value is associated with a control and is sorted using conditional
statements.

For example, if btnA has been clicked, the global calendar variable, calval,
would be equal to 1. Then on the same form or another form, if btnB is
clicked, calval = 2, and so forth. A button on a calendar control form when
clicked runs through simple If-Then-Else or Case Select statements used to
direct the calendar control output to the correct field associated with btnA
or B, based on the calval value. Be sure to clear the calval for each
interaction so when you call the calendar control the each time, you don't
risk the chance of transposing a date over a previous field.

This may be fairly rudimentary for a solution, it has worked well for me
where multiple date fields are present on the same form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top