Disable fields based on value selected in Combo box (1 Viewer)

popeye

Work smarter, not harder.
Local time
Yesterday, 18:15
Joined
Aug 23, 2004
Messages
75
i want to be able to select a phrase from a combo box and when that particular phrase is selected then some fields in particular become disabled.
 

WayneRyan

AWF VIP
Local time
Today, 02:15
Joined
Nov 19, 2002
Messages
7,122
popeye,

Use the AfterUpdate event of the ComboBox to:

Code:
Select Case Me.YourCombo
   Case "TextA"
      Me.Field1.Enabled = False
      Me.Field2.Enabled = False
      Me.Field3.Enabled = True
      Me.Field4.Enabled = True
   Case "TextB"
      Me.Field1.Enabled = True
      Me.Field2.Enabled = True
      Me.Field3.Enabled = False
      Me.Field4.Enabled = False
   End Select

Wayne
 

popeye

Work smarter, not harder.
Local time
Yesterday, 18:15
Joined
Aug 23, 2004
Messages
75
thanks

as we in Jamaica would say

Respect Mon, Di I Cool enu...
bless.
 

popeye

Work smarter, not harder.
Local time
Yesterday, 18:15
Joined
Aug 23, 2004
Messages
75
ok, i want the fields not only disabled, but their values returned to zero

i want the disabled fields to have the value zero displayed in them anbd saved to the table.

Please advise :)
 

mohammadagul

PrinceAtif
Local time
Today, 05:15
Joined
Mar 14, 2004
Messages
298
the same code as mentioned by WayneRyan with an addition of the following

Select Case Me.YourCombo
Case "TextA"
Me.Field1.Enabled = False
Me.Field2.Enabled = False
Me.Field3.Enabled = True
Me.Field4.Enabled = True

Me.Field1.Value = 0
Me.Field2.Value = 0
Me.Field3.Enabled = WhatEverValueYouWant
Me.Field4.Enabled = WhatEverValueYouWant

End Select
 

Users who are viewing this thread

Top Bottom