Hi guys Goodmorning i need a big help, can anyone give me a script for option button, i have create a application form which i must create a option button
this is the scenario
Types of leave
button 1 - Vacation
button 2 - Sick
button 3 - Other (Specify) _____
the user must choose only one button so if they click one of the button the other 2 will be disable and if i the user choose the (Other button) they fill up the specify text box that will update my table, what will be my code for this? thanks very much for the help
The easiest way to accomplish what you are requesting is via the Option Group Wizard. Here is the procedure.
__
01. Create a Field say [Leave_ID](LONG) in the underlying Record Source (Table) for your Application Form.
__
02. Create a Field in the same manner named [Other](TEXT).
__
03. Create a Text Box on your Form and name it txtOther. This Text Box cannot be within the Option Group you are about to create. Set its Visible Property to No.
__
04. View ==> Toolbox ==> Option Group. Size it appropriately on your Application Form.
__
05. Whem prompted for Label Names enter: Vacation, Sick, and Other (Specify).
__
06. Select No default.
__
07. When prompted for Values for your Options stay with the Defaults of 1, 2, and 3.
__
08. When asked, store the Value in the [Leave_ID] Field.
__
09. Select Option Buttons then select an appropriate Style.
__
10. Name your Option Group fraLeave.
__
11. Place this code in the AfterUpdate() Event of the Option Group. When Option 3 is selected Other (Specify), the Text Box will become Visible. If any one of the other two Options is selected, it will be Invisible.
__
12. Make sure the Control Source for txtOther is set to the newly created [Other] Field.
- Private Sub fraLeave_AfterUpdate()
-
Me![txtOther].Visible = Me![fraLeave].Value = 3
-
End Sub