Full Version: Working with 'Enabled' property of controls
UtterAccess Forums > Microsoft® Access > Access Forms
dyrdasteve
What I am attempting to do is toggle between the enabled property (T/F) for some controls on this tab controlled main form. See attached. The controls do not change when the criteria in the code changes. Is it because I am not referencing the tab control properly. If so, I could use some help. Not sure how that is notated.
Ostudied the access help file to get where I am at now ... could use some more input.
Thanks ahead,
Steve
JayNoelOlimpo
hi;
eem to work here ...
Try this one in the after update event procedure ...
TOB.Enabled = (ForgottenThisControl.Enabled = False) grin.gif
and in the other control ...
ForgottenThisControl.Enabled = (TOB.Enabled = False)
HTH.
dyrdasteve
What is TOB?
JayNoelOlimpo
Got it now FOB and ForgottenThisControl is the DHO ...
dyrdasteve
Oh sorry Jay but I do not have trouble with that piece. It is working fine.
It is in this section of code ...
Private Sub categoryID_Current()
If Me!categoryID = 3 Then
Me!FCFeather.Enabled = False
Me!FCPoly.Enabled = False
Me!FCShell.Enabled = False
Else
Me!FCThrow.Enabled = False
End If

End Sub
JayNoelOlimpo
Hmmm ... The categoryID seems to be an AutoNumber confused.gif
o you mean the category ?
Throws or Pillows, try placing it in the Foms On Current Event ...
dyrdasteve
CategoryID is an auto number.
Just another attempt at trying to make this work.
I will try it ....
If Me.Categories = "Pillows" Then
Me.FCThrows.Enabled = False
ElseIf Me.Categories = "Throws" Then
Me.FCPoly.Enabled = False
Me.FCShells.Enabled = False
Me.FCFeather.Enabled = False
End If
JayNoelOlimpo
GOOD LUCK, Keep us posted on the updates. grin.gif

Place it on current of the form and also on after update event of categories.
dyrdasteve
no go ...
Private Sub category_AfterUpdate()
If Me!category = "Throws" Then
Me!FCFeather.Enabled = False
Me!FCPoly.Enabled = False
Me!FCShell.Enabled = False
ElseIf Me!category = "Pillows" Then
Me!FCThrow.Enabled = False
End If

End Sub
other suggestions ???
JayNoelOlimpo
You'll have to re-enable the FCFeather, FCPoly ...

If Me!category = "Throws" Then
Me!FCFeather.Enabled = False
Me!FCPoly.Enabled = False
Me!FCShell.Enabled = False
Me!FCThrow.Enabled = True
ElseIf Me!category = "Pillows" Then
Me!FCFeather.Enabled = True
Me!FCPoly.Enabled = True
Me!FCShell.Enabled = True
Me!FCThrow.Enabled = False
End If

Also you have to unlock the category control.
dyrdasteve
acting strange ... please see attached
more advice sought ...
Thanks
JayNoelOlimpo
Here it is ...
dyrdasteve
Jay, thanks for trying to help. It just does not act as it should.
If i go back and change the size again to one and then the other category it will not set the enable properties accordingly.
hmmm ...
dyrdasteve
this is what I am working with now. this is being very elusive. what's up?
Private Sub category_AfterUpdate()
If Me.category = "Throws" Then
Me.FCFeather.Enabled = False
Me.FCPoly.Enabled = False
Me.FCShell.Enabled = False
Me.FCThrow.Enabled = True
ElseIf Me.category = "Pillows" Then
Me.FCFeather.Enabled = True
Me.FCPoly.Enabled = True
Me.FCShell.Enabled = True
Me.FCThrow.Enabled = False
ElseIf IsNull(Me.category) Then
Me.FCFeather.Enabled = True
Me.FCPoly.Enabled = True
Me.FCShell.Enabled = True
Me.FCThrow.Enabled = True
End If
End Sub
JayNoelOlimpo
You should place that On Current event of form.
dyrdasteve
is that all? what about the afterUpdate event for the category control??
dyrdasteve
Jay -
Not it to work. I put the code on the 'OnChange' event of the control sizeID on the form and it works perfectly.
Thanks again for hanging in there with me.
Steve
JayNoelOlimpo
Glad you figured it out. thumbup.gif
GOOD LUCK!
dyrdasteve
Back with this type of programming. As you can see from the thread I have gone through this exercise once before and figured this should go without a problem .... wrong!
I have been working with this for the last 60 minutes and am drawing blanks having looked at seemingly all the angles - time for another set of eyes here.
File attached ... I want to enable / disable the controls on the Product costing tab that contain the ocean rates.
If the vendor (and hence country) changes I would like the corresponding rate field to remain enabled and the other to be disabled.
Can anyone see what is missing here?
Thanks ahead,
Steve
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.