D
Dkline
As I load a subform I want to control the availability of some command
buttons on the form. (BTW - one of the subforms will have a subform).
In lieu of the Navigation Controls, I am to add command buttons that control
the record set. So I have buttons to take you to the First, Last, Previous,
or Next records. The idea is the "Previous" button should not be available
if you are at the start of the recordset and the "Next" button should not be
available when you are at the end of the recordset.
I created a module which handles the availability using the procedure
"ButtonAvailability". All of the controls are named the same on each form
e.g. cmdFirst, cmdLast, cmdPrevious, cmdNext.
In the top level forms this works fine.
Dim strCurrForm As String
strCurrForm = Me.Form.Name
ButtonAvailability (strCurrForm)
The problem is the subforms. I cannot get the syntax right for the
strCurrForm.
strCurrForm = Forms("frmMain")!Form("frmPoliciesInsureds_Sub")
This gives a 2465 error.
Other attempts:
strCurrForm = Forms("frmMain").Form("frmPoliciesInsureds_Sub")
strCurrForm = Forms("frmMain").Form("frmPoliciesInsureds_Sub").Name
strCurrForm = Forms("frmMain").Form(strCurrForm)
What am I missing? Is there a better way to do this?
buttons on the form. (BTW - one of the subforms will have a subform).
In lieu of the Navigation Controls, I am to add command buttons that control
the record set. So I have buttons to take you to the First, Last, Previous,
or Next records. The idea is the "Previous" button should not be available
if you are at the start of the recordset and the "Next" button should not be
available when you are at the end of the recordset.
I created a module which handles the availability using the procedure
"ButtonAvailability". All of the controls are named the same on each form
e.g. cmdFirst, cmdLast, cmdPrevious, cmdNext.
In the top level forms this works fine.
Dim strCurrForm As String
strCurrForm = Me.Form.Name
ButtonAvailability (strCurrForm)
The problem is the subforms. I cannot get the syntax right for the
strCurrForm.
strCurrForm = Forms("frmMain")!Form("frmPoliciesInsureds_Sub")
This gives a 2465 error.
Other attempts:
strCurrForm = Forms("frmMain").Form("frmPoliciesInsureds_Sub")
strCurrForm = Forms("frmMain").Form("frmPoliciesInsureds_Sub").Name
strCurrForm = Forms("frmMain").Form(strCurrForm)
What am I missing? Is there a better way to do this?