programming several date options

  • Thread starter Thread starter Jo Ann
  • Start date Start date
J

Jo Ann

In a form that I am creating I want to include in a drop
down box two date options: documented and estimated.
When Documented is chosen, mm/dd/yyyy is entered in the
box. Whe Estimated is chosen I need a box to open up
that says from mm/dd/yyyy to mm/dd/yyyy. In addition I
need a free text box to open up so that an explanation
can be entered.
Can this be done and if so can anyone help me set it up?
Thanks in advance
 
Do you have fields in your table to store the 2 different dates? Assuming
you do, just put all the fields into your form. I am also assuming you want
this logic to occur while you are viewing your records too.

If your boxes have the names cboOption, txtStartDate, txtEndDate, and
txtExplanation, in the OnCurrent event of the form add the following code:

If (cboOption = "Documented") then
txtEndDate.Visible = False
txtExplanation.Visible = False
Else
txtEndDate.Visible = True
txtExplanation.Visible = True
End If

This will make the extra boxes invisible of "Documented" is chosen. If the
combo box is bound to another field like an option ID, then change
"Documented" to the correct ID number to match. Then on the AfterUpdate
event of the combo box add this code:

call Form_OnCurrent

To run the code again. If you want chnage options from Estimated to
Documented, did you want to erase the extra information. Then change the
above to:

txtEndDate = ""
txtExplanation = ""
Call Form_Current

Kelvin
 
Back
Top