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

Enable/Disable Subform

Status
Not open for further replies.

2Grandpa

Programmer
Jun 13, 2003
38
US
I use the code listed below to enable\disable a subform based on a selection in a combo box. The changing colors, locking and Enable = False work fine in the Else part. Every thing works in the If part except the 'Enabled = True'. The form is not enabled so data can be entered into fields.

The problem comes when I change from "Independent" to "Non-Independent" and then change back to "Independent". At this point I want to be able to enter data again.


Private Sub cboIndependent_AfterUpdate()

If cboIndependent = "Independent" Then
Me.cboCapable.BackColor = 52479
Me.cboCapable.Locked = False
Me.cboCapable.Value = "N/A"
Me.cboFollowed.BackColor = 52479
Me.cboFollowed.Locked = False
Me.cboFollowed.Value = "N/A"
Forms!frmProcessProofing! frmProcessReviewResults!.Form!ProcessObs.BackColor = 16777215
Forms!frmProcessProofing!frmProcessReviewResults!.Form!Defectiveobs.BackColor = 16777215
Me.frmProcessReviewResults.Enabled = True
Else
Me.cboCapable.BackColor = 8421504
Me.cboCapable.Locked = True
Me.cboCapable.Value = "N/A"
Me.cboFollowed.BackColor = 8421504
Me.cboFollowed.Locked = True
Me.cboFollowed.Value = "N/A"
Forms!frmProcessProofing!frmProcessReviewResults!.Form!ProcessObs.BackColor = 8421504
Forms!frmProcessProofing!frmProcessReviewResults!.Form!Defectiveobs.BackColor = 8421504
Me.frmProcessReviewResults.Enabled = False
End If

End Sub

Thanks for your help.
 
I tried your code and it seems to work for me. There is a small funny here:
Forms!frmProcessProofing!frmProcessReviewResults!.Form!ProcessObs.BackColor = 8421504

(you have both a bang and a dot, it should just be a dot) but it still runs ok for me. I suppose you have checked the spelling of everything? [ponder]
 
I found the problem some how the forms Allow Edits attribute had got changed to No.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top