E
every1luvsVB via AccessMonster.com
Hi there,
I am having trouble referencing form objects in my custom-defined sub routine.
- In the calling statement, I pass the form as 'Me'; defining it as 'thisForm
As Form' in the custom sub's argument list. This is recognised in my
subroutine and is not a problem.
- In the calling statement, I also pass a reference to a button control on
this form as a subsequent argument. In this instance, I pass the control as
'Me!btnOpenReport'; and define it as 'strButtonName As String' in the custom
sub's argument list.
- When I then try to manipulate Me!btnOpenReport's properties from within my
custom subroutine, eg. via 'thisForm!strButtonName.enabled = False', I
receive the following error..
Run-time error '2465':
Microsoft Office Access can't find the field 'strButtonName' referred to in
your expression.
I expect I should not pass the button reference as a string but cannot figure
out the correct syntax. Can anyone help?
I am having trouble referencing form objects in my custom-defined sub routine.
- In the calling statement, I pass the form as 'Me'; defining it as 'thisForm
As Form' in the custom sub's argument list. This is recognised in my
subroutine and is not a problem.
- In the calling statement, I also pass a reference to a button control on
this form as a subsequent argument. In this instance, I pass the control as
'Me!btnOpenReport'; and define it as 'strButtonName As String' in the custom
sub's argument list.
- When I then try to manipulate Me!btnOpenReport's properties from within my
custom subroutine, eg. via 'thisForm!strButtonName.enabled = False', I
receive the following error..
Run-time error '2465':
Microsoft Office Access can't find the field 'strButtonName' referred to in
your expression.
I expect I should not pass the button reference as a string but cannot figure
out the correct syntax. Can anyone help?