D
Dylan Moran
I think there should be a simple solution to my problem. I have searched and
found similar questions and tried to implement suggested solutions, but to
date no success, so I am hoping you will be patient with me and help with a
question that appears to have been asked many times before. Thanks in advance
for your patience and time.
I have a form (frm02Company) with a subform (frm08ReturnAnalysis). And my
searching the forum has identified that a subform is actually a *control*. I
have also read that the subform *control* is sometimes not the name of the
subform itself, however I am unsure of how to identify the name of the
subform *control*. The subfom was created using the wizard and utilised an
already created form, so I am guessing that the subform *control* is most
likely the same name as the subform itself.
Any help as to how to identify the subform *control* name would be
appreciated.
But my real problem is referencing the controls on this subform in VBA.
Below is the code as it stands.
Basically I call a procedure in a module that I want to enable and unlock
controls on my subform.
In the on_current event of my subform (note subform on_current event) I have
this:
Private Sub Form_Current()
Call EnableAndUnlock
End Sub
And in a module, the procedure I call I have this:
Sub EnableAndUnlock()
On Error GoTo ErrorPoint
' ***** EnableAndUnlock code starts here *****
Forms!frm08ReturnAnalysis.year.Enabled = True
Forms!frm08ReturnAnalysis.Risk.Enabled = True
' Controls (Not Locked)
Forms!frm08ReturnAnalysis.year.Locked = False
Forms!frm08ReturnAnalysis.Risk.Locked = False
ExitPoint:
Exit Sub
ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " _
& Err.Description, vbExclamation, _
"Unexpected Error"
Resume ExitPoint
End Sub
The error that I get is
"Cannot find the form 'frm08ReturnAnalysis'
Any assistance in how to accurately reference the controls on my subform
from the called procedure would be most appreciated. An example using my
code would be more than appreciated, it would make my week!
Thanks
found similar questions and tried to implement suggested solutions, but to
date no success, so I am hoping you will be patient with me and help with a
question that appears to have been asked many times before. Thanks in advance
for your patience and time.
I have a form (frm02Company) with a subform (frm08ReturnAnalysis). And my
searching the forum has identified that a subform is actually a *control*. I
have also read that the subform *control* is sometimes not the name of the
subform itself, however I am unsure of how to identify the name of the
subform *control*. The subfom was created using the wizard and utilised an
already created form, so I am guessing that the subform *control* is most
likely the same name as the subform itself.
Any help as to how to identify the subform *control* name would be
appreciated.
But my real problem is referencing the controls on this subform in VBA.
Below is the code as it stands.
Basically I call a procedure in a module that I want to enable and unlock
controls on my subform.
In the on_current event of my subform (note subform on_current event) I have
this:
Private Sub Form_Current()
Call EnableAndUnlock
End Sub
And in a module, the procedure I call I have this:
Sub EnableAndUnlock()
On Error GoTo ErrorPoint
' ***** EnableAndUnlock code starts here *****
Forms!frm08ReturnAnalysis.year.Enabled = True
Forms!frm08ReturnAnalysis.Risk.Enabled = True
' Controls (Not Locked)
Forms!frm08ReturnAnalysis.year.Locked = False
Forms!frm08ReturnAnalysis.Risk.Locked = False
ExitPoint:
Exit Sub
ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " _
& Err.Description, vbExclamation, _
"Unexpected Error"
Resume ExitPoint
End Sub
The error that I get is
"Cannot find the form 'frm08ReturnAnalysis'
Any assistance in how to accurately reference the controls on my subform
from the called procedure would be most appreciated. An example using my
code would be more than appreciated, it would make my week!
Thanks