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

Enable field when option selected 2

Status
Not open for further replies.

kayjayten

MIS
Dec 17, 2002
2
GB
I have an option group with 2 options (Fixed term or Continuous).

With both options there is a Start date field. When the Fixed term option is selected, I want to enable an End date field (or disable End date when the Continuous option is selected.)

I have no understanding of VB code, but am reasonable conversant with macros. What do I need to set, and in which field??

Thanks in advance.
 
You would be best using vb code: -

I will explain it to you.

Paste the code below into the code window, all of it. You will need to change where i have used FRAME_NAME for your control name, and End_Date for your end date text box name.

Code:
Public Sub UpdateGroup()

Select Case Me.FRAME_NAME.Value

Case 1

End_date.Enabled = True

Case 2

End_date.Enabled = False

End Select

End Sub

Private Sub Form_Current()
UpdateGroup
End Sub

What you now want to to is on your option group, right click on that and select the properties, then select the event tab, pick the After Update line, click on the combo box for this line, and pick event procedure, and then click on the 3 dots to the right of the line, which will take ytou to the code window.

In this procedure put the following code in.

UpdateGroup

What this will do is everytime the record is changed it will update the end_date to whether or not to show it as enabled or not. I hope this helps.

If you are stuck please let me know



 
In the AfterUpdate event of the control hosting the option group:
Me![End date control name].Enabled = (Me![option group frame name] = 1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top