Block textbox

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

Guest

I have a form that has the following textbox on it:
1) InputQty
2) InputDate
3) WithdrawQty
4) WithdrawDate

I wld like to add in the option buttons such that if I select "Input", the
"WithdrawQty" and "WithdrawDate" textbox will be locked. The opp occurs if I
am to select "Output" for the option button.

May I know what's the syntax for blocking of textbox???
 
I have a form that has the following textbox on it:
1) InputQty
2) InputDate
3) WithdrawQty
4) WithdrawDate

I wld like to add in the option buttons such that if I select "Input", the
"WithdrawQty" and "WithdrawDate" textbox will be locked. The opp occurs if I
am to select "Output" for the option button.

May I know what's the syntax for blocking of textbox???

Set its Enabled property to False. You'll want the code both in the
AfterUpdate event of the option button control, and the form's Current
event. Assuming that the Option Group uses 1 to signify Input, and 2
Output, and that this value is stored in the field TranType, code like
this should work:

Private Sub optTranType_AfterUpdate()
Me!InputQty.Enabled = (Me!TranType = 1)
Me!InputDate.Enabled = (Me!TranType = 1)
Me!WithdrawQty.Enabled = (Me!TranType = 2)
Me!WithdrawDate.Enabled = (Me!TranType = 2)
End Sub

with similar code in the form's Current event to enable/disable the
controls for existing records.

John W. Vinson[MVP]
 
Back
Top