Why won't it enable the control in Subform?

tafnuef1

Registered User.
Local time
Today, 12:02
Joined
Apr 22, 2010
Messages
43
Here is my scenario I want to make a choice in the last combo box in the mainform and then set focus and enable) the first combo box in the subform. (I have the fields disabled till the previous field is entered and it works in mainform with no issues). Now why can't I get focus or enable my first combo box in my subform?? HELP!


Mainform = DIQA
Subform = Audit_Errors_Subform
last Combo box on Mainform = Indexer_Name
First Combo box on subform = Prepper_Error

This is what I have in the OnChange Event

If Me.Indexer_Name = "" Then
MsgBox "Please enter a Indexer Name"
Cancel = True

Exit Sub

End If
Me!Audit_Errors_Subform.SetFocus
Me!Audit_Errror_Subform.Form!Prepper_Error.Enabled = True
Me!Audit_Errror_Subform.Form!Prepper_Error.SetFocus


End Sub
 
1. You say:

Subform = Audit_Errors_Subform

But then use
Audit_Error_Subform (without the S).

2. You need to use the name of the subform control (control on the main form which houses the subform) and NOT the name of the subform (unless they are exactly the same).

3. Don't use the BANG (!) after ME nor after the FORM part.
Code:
Me.YourSubformControlName.Form.ControlNameHere.Enabled = True
 
Can you have Exit Sub between If and End If?
 
Holy Smokes what a dummy....I had things typed in way wrong.. like Error spelled Errror.. duhhh anyway I got it working now WHO HOO

Here is what it looks like now:

Private Sub Indexer_Name_Change()
If Me.Indexer_Name = "" Then
MsgBox "Please enter a Indexer Name"
Cancel = True

Exit Sub

End If
Me.Audit_Errors_Subform.SetFocus
Me.Audit_Errors_Subform.Form.Prepper_Error.Enabled = True
Me.Audit_Errors_Subform.Form.Prepper_Error.SetFocus


End Sub
 

Users who are viewing this thread

Back
Top Bottom