Main form : FrmManu
Sub form : frmManu_Sub
I can set the following as the on click event of a label in sub form's property sheet:
Works fine.
But when I want to set the exact structure in main form's open event, I receive an error:
Error line is :
Me.frmManu_Sub.Form.Controls("lblSortRec_ID").OnClick = Expression
Error:
Run time error 2423
The expression you entered has an invalid . (dot) or ! operator or invalid parentheses.
If I change it to Me.frmManu_Sub.Form.Controls("lblSortRec_ID").OnClick = ""
the error doesn't show. Which proves the path to control is correct. And Access detects an error in the expression I'm trying to assign.
What am I doing wrong.
Thanks.
Sub form : frmManu_Sub
I can set the following as the on click event of a label in sub form's property sheet:
Code:
=ReSortForm2(Forms('frmManu').[frmManu_Sub].[Form])
But when I want to set the exact structure in main form's open event, I receive an error:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim Expression As String
Expression = "=ReSortForm2(Forms('frmManu').[frmManu_Sub].[Form])"
Me.frmManu_Sub.Form.Controls("lblSortRec_ID").OnClick = Expression
End Sub
Error line is :
Me.frmManu_Sub.Form.Controls("lblSortRec_ID").OnClick = Expression
Error:
Run time error 2423
The expression you entered has an invalid . (dot) or ! operator or invalid parentheses.
If I change it to Me.frmManu_Sub.Form.Controls("lblSortRec_ID").OnClick = ""
the error doesn't show. Which proves the path to control is correct. And Access detects an error in the expression I'm trying to assign.
What am I doing wrong.
Thanks.