I found this code (EnableFormControls) in the forum to enable/disable
controls on a form but I'm having trouble setting the variable 'frmAny' and
passing it to the sub EnableFormControls. What am I doing wrong?
Sub EnableFormControls(frmAny As Form, _
strControlSkip As String, _
Optional tfEnable As Boolean = True)
Dim ctlAny As Control
On Error GoTo ERROR_Handler
frmAny(strControlSkip).SetFocus
For Each ctlAny In frmAny.Controls
If ctlAny.Name <> strControlSkip Then
Select Case ctlAny.ControlType
Case acCheckBox, acComboBox, acCommandButton _
, acListBox, acOptionGroup, acSubform _
, acTextBox, acToggleButton
ctlAny.Enabled = tfEnable
End Select
End If
Next ctlAny
Exit Sub
ERROR_Handler:
If Err.Number = 2164 Then
Resume Next
Else
MsgBox Err.Number & ": " & Err.Description, , _
"Error in EnableFormControls"
End If
End Sub
Private Sub Command1_Click()
Dim frmAny As Form
Dim strControlSkip As String
Dim tfEnable As Boolean
frmAny = Form2
strControlSkip = "Text2"
tfEnable = False
EnableFormControls frmAny, strControlSkip, tfEnable
End Sub
|
|
0
|
|
|
|
Reply
|
Utf
|
2/16/2010 11:56:01 PM |
|
"Pastor Del" <PastorDel@discussions.microsoft.com> wrote in message
news:6C2693D5-769E-493E-807E-9C49648E7156@microsoft.com...
>I found this code (EnableFormControls) in the forum to enable/disable
> controls on a form but I'm having trouble setting the variable 'frmAny'
> and
> passing it to the sub EnableFormControls. What am I doing wrong?
>
> Sub EnableFormControls(frmAny As Form, _
> strControlSkip As String, _
> Optional tfEnable As Boolean = True)
> Dim ctlAny As Control
> On Error GoTo ERROR_Handler
> frmAny(strControlSkip).SetFocus
> For Each ctlAny In frmAny.Controls
> If ctlAny.Name <> strControlSkip Then
> Select Case ctlAny.ControlType
> Case acCheckBox, acComboBox, acCommandButton _
> , acListBox, acOptionGroup, acSubform _
> , acTextBox, acToggleButton
> ctlAny.Enabled = tfEnable
> End Select
> End If
> Next ctlAny
> Exit Sub
>
> ERROR_Handler:
> If Err.Number = 2164 Then
> Resume Next
> Else
> MsgBox Err.Number & ": " & Err.Description, , _
> "Error in EnableFormControls"
> End If
> End Sub
>
> Private Sub Command1_Click()
> Dim frmAny As Form
> Dim strControlSkip As String
> Dim tfEnable As Boolean
>
>
> frmAny = Form2
> strControlSkip = "Text2"
> tfEnable = False
>
> EnableFormControls frmAny, strControlSkip, tfEnable
> End Sub
>
First off, the form must be open for this code to work. Also you need to
reference the form via the Forms collection, like this:
frmAny = Forms!Form2
|
|
0
|
|
|
|
Reply
|
Stuart
|
2/17/2010 12:14:54 AM
|
|
See if this helps. Instead of passing it as a form, I suggest passing the
form name as string:
Sub EnableFormControls(strFrmAny As string, _
strControlSkip As String, _
Optional tfEnable As Boolean = True)
Dim ctlAny As Control
On Error GoTo ERROR_Handler
Forms(strFrmAny).(strControlSkip).SetFocus
For Each ctlAny In Forms(strFrmAny).Controls
If ctlAny.Name <> strControlSkip Then
Select Case ctlAny.ControlType
Case acCheckBox, acComboBox, acCommandButton, _
acListBox, acOptionGroup, acSubform, _
acTextBox, acToggleButton
ctlAny.Enabled = tfEnable
End Select
End If
Next ctlAny
Exit Sub
ERROR_Handler:
If Err.Number = 2164 Then
Resume Next
Else
MsgBox Err.Number & ": " & Err.Description, , _
"Error in EnableFormControls"
End If
End Sub
Private Sub Command1_Click()
Dim strFrmAny As string
Dim strControlSkip As String
Dim tfEnable As Boolean
strFrmAny = "frmAny"
strControlSkip = "Text2"
tfEnable = False
EnableFormControls strFrmAny, strControlSkip, tfEnable
End Sub
"Pastor Del" wrote:
> I found this code (EnableFormControls) in the forum to enable/disable
> controls on a form but I'm having trouble setting the variable 'frmAny' and
> passing it to the sub EnableFormControls. What am I doing wrong?
>
> Sub EnableFormControls(frmAny As Form, _
> strControlSkip As String, _
> Optional tfEnable As Boolean = True)
> Dim ctlAny As Control
> On Error GoTo ERROR_Handler
> frmAny(strControlSkip).SetFocus
> For Each ctlAny In frmAny.Controls
> If ctlAny.Name <> strControlSkip Then
> Select Case ctlAny.ControlType
> Case acCheckBox, acComboBox, acCommandButton _
> , acListBox, acOptionGroup, acSubform _
> , acTextBox, acToggleButton
> ctlAny.Enabled = tfEnable
> End Select
> End If
> Next ctlAny
> Exit Sub
>
> ERROR_Handler:
> If Err.Number = 2164 Then
> Resume Next
> Else
> MsgBox Err.Number & ": " & Err.Description, , _
> "Error in EnableFormControls"
> End If
> End Sub
>
> Private Sub Command1_Click()
> Dim frmAny As Form
> Dim strControlSkip As String
> Dim tfEnable As Boolean
>
>
> frmAny = Form2
> strControlSkip = "Text2"
> tfEnable = False
>
> EnableFormControls frmAny, strControlSkip, tfEnable
> End Sub
>
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 4:33:01 AM
|
|
You could also try: -
frmAny = Me
--
A nod is as good as a wink to a blind horse.
"Pastor Del" wrote:
> I found this code (EnableFormControls) in the forum to enable/disable
> controls on a form but I'm having trouble setting the variable 'frmAny' and
> passing it to the sub EnableFormControls. What am I doing wrong?
>
> Sub EnableFormControls(frmAny As Form, _
> strControlSkip As String, _
> Optional tfEnable As Boolean = True)
> Dim ctlAny As Control
> On Error GoTo ERROR_Handler
> frmAny(strControlSkip).SetFocus
> For Each ctlAny In frmAny.Controls
> If ctlAny.Name <> strControlSkip Then
> Select Case ctlAny.ControlType
> Case acCheckBox, acComboBox, acCommandButton _
> , acListBox, acOptionGroup, acSubform _
> , acTextBox, acToggleButton
> ctlAny.Enabled = tfEnable
> End Select
> End If
> Next ctlAny
> Exit Sub
>
> ERROR_Handler:
> If Err.Number = 2164 Then
> Resume Next
> Else
> MsgBox Err.Number & ": " & Err.Description, , _
> "Error in EnableFormControls"
> End If
> End Sub
>
> Private Sub Command1_Click()
> Dim frmAny As Form
> Dim strControlSkip As String
> Dim tfEnable As Boolean
>
>
> frmAny = Form2
> strControlSkip = "Text2"
> tfEnable = False
>
> EnableFormControls frmAny, strControlSkip, tfEnable
> End Sub
>
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 6:01:02 AM
|
|
I tried 'frmAny = Me' without success. DrGUI suggests that I try passing the
name as a string. I'll probably go that way because I know I can pass a
string, but for the sake of greater understanding I'd like to know why I
can't pass it as a form. Any ideas?
"ChrisO" wrote:
> You could also try: -
> frmAny = Me
>
> --
> A nod is as good as a wink to a blind horse.
>
>
> "Pastor Del" wrote:
>
> > I found this code (EnableFormControls) in the forum to enable/disable
> > controls on a form but I'm having trouble setting the variable 'frmAny' and
> > passing it to the sub EnableFormControls. What am I doing wrong?
> >
> > Sub EnableFormControls(frmAny As Form, _
> > strControlSkip As String, _
> > Optional tfEnable As Boolean = True)
> > Dim ctlAny As Control
> > On Error GoTo ERROR_Handler
> > frmAny(strControlSkip).SetFocus
> > For Each ctlAny In frmAny.Controls
> > If ctlAny.Name <> strControlSkip Then
> > Select Case ctlAny.ControlType
> > Case acCheckBox, acComboBox, acCommandButton _
> > , acListBox, acOptionGroup, acSubform _
> > , acTextBox, acToggleButton
> > ctlAny.Enabled = tfEnable
> > End Select
> > End If
> > Next ctlAny
> > Exit Sub
> >
> > ERROR_Handler:
> > If Err.Number = 2164 Then
> > Resume Next
> > Else
> > MsgBox Err.Number & ": " & Err.Description, , _
> > "Error in EnableFormControls"
> > End If
> > End Sub
> >
> > Private Sub Command1_Click()
> > Dim frmAny As Form
> > Dim strControlSkip As String
> > Dim tfEnable As Boolean
> >
> >
> > frmAny = Form2
> > strControlSkip = "Text2"
> > tfEnable = False
> >
> > EnableFormControls frmAny, strControlSkip, tfEnable
> > End Sub
> >
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 5:58:02 PM
|
|
The form was open and I tried 'frmAny = Forms!Form2' without success. DrGUI
suggests that I try passing the name as a string. I'll probably go that way
because I know I can pass a string, but for the sake of greater understanding
I'd like to know why I can't pass it as a form. Any ideas?
"Stuart McCall" wrote:
> "Pastor Del" <PastorDel@discussions.microsoft.com> wrote in message
> news:6C2693D5-769E-493E-807E-9C49648E7156@microsoft.com...
> >I found this code (EnableFormControls) in the forum to enable/disable
> > controls on a form but I'm having trouble setting the variable 'frmAny'
> > and
> > passing it to the sub EnableFormControls. What am I doing wrong?
> >
> > Sub EnableFormControls(frmAny As Form, _
> > strControlSkip As String, _
> > Optional tfEnable As Boolean = True)
> > Dim ctlAny As Control
> > On Error GoTo ERROR_Handler
> > frmAny(strControlSkip).SetFocus
> > For Each ctlAny In frmAny.Controls
> > If ctlAny.Name <> strControlSkip Then
> > Select Case ctlAny.ControlType
> > Case acCheckBox, acComboBox, acCommandButton _
> > , acListBox, acOptionGroup, acSubform _
> > , acTextBox, acToggleButton
> > ctlAny.Enabled = tfEnable
> > End Select
> > End If
> > Next ctlAny
> > Exit Sub
> >
> > ERROR_Handler:
> > If Err.Number = 2164 Then
> > Resume Next
> > Else
> > MsgBox Err.Number & ": " & Err.Description, , _
> > "Error in EnableFormControls"
> > End If
> > End Sub
> >
> > Private Sub Command1_Click()
> > Dim frmAny As Form
> > Dim strControlSkip As String
> > Dim tfEnable As Boolean
> >
> >
> > frmAny = Form2
> > strControlSkip = "Text2"
> > tfEnable = False
> >
> > EnableFormControls frmAny, strControlSkip, tfEnable
> > End Sub
> >
>
> First off, the form must be open for this code to work. Also you need to
> reference the form via the Forms collection, like this:
>
> frmAny = Forms!Form2
>
>
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 5:58:12 PM
|
|
Thanks, I'm sure I can pass the string & I'll probably do it this way. But,
can you explain why I couldn't pass it as a form, just for a better
understanding of the beast?
"DrGUI" wrote:
> See if this helps. Instead of passing it as a form, I suggest passing the
> form name as string:
>
> Sub EnableFormControls(strFrmAny As string, _
> strControlSkip As String, _
> Optional tfEnable As Boolean = True)
>
> Dim ctlAny As Control
> On Error GoTo ERROR_Handler
>
> Forms(strFrmAny).(strControlSkip).SetFocus
>
> For Each ctlAny In Forms(strFrmAny).Controls
> If ctlAny.Name <> strControlSkip Then
> Select Case ctlAny.ControlType
> Case acCheckBox, acComboBox, acCommandButton, _
> acListBox, acOptionGroup, acSubform, _
> acTextBox, acToggleButton
> ctlAny.Enabled = tfEnable
> End Select
> End If
> Next ctlAny
>
> Exit Sub
>
> ERROR_Handler:
> If Err.Number = 2164 Then
> Resume Next
> Else
> MsgBox Err.Number & ": " & Err.Description, , _
> "Error in EnableFormControls"
> End If
> End Sub
>
> Private Sub Command1_Click()
> Dim strFrmAny As string
> Dim strControlSkip As String
> Dim tfEnable As Boolean
>
>
> strFrmAny = "frmAny"
> strControlSkip = "Text2"
> tfEnable = False
>
> EnableFormControls strFrmAny, strControlSkip, tfEnable
>
> End Sub
>
>
> "Pastor Del" wrote:
>
> > I found this code (EnableFormControls) in the forum to enable/disable
> > controls on a form but I'm having trouble setting the variable 'frmAny' and
> > passing it to the sub EnableFormControls. What am I doing wrong?
> >
> > Sub EnableFormControls(frmAny As Form, _
> > strControlSkip As String, _
> > Optional tfEnable As Boolean = True)
> > Dim ctlAny As Control
> > On Error GoTo ERROR_Handler
> > frmAny(strControlSkip).SetFocus
> > For Each ctlAny In frmAny.Controls
> > If ctlAny.Name <> strControlSkip Then
> > Select Case ctlAny.ControlType
> > Case acCheckBox, acComboBox, acCommandButton _
> > , acListBox, acOptionGroup, acSubform _
> > , acTextBox, acToggleButton
> > ctlAny.Enabled = tfEnable
> > End Select
> > End If
> > Next ctlAny
> > Exit Sub
> >
> > ERROR_Handler:
> > If Err.Number = 2164 Then
> > Resume Next
> > Else
> > MsgBox Err.Number & ": " & Err.Description, , _
> > "Error in EnableFormControls"
> > End If
> > End Sub
> >
> > Private Sub Command1_Click()
> > Dim frmAny As Form
> > Dim strControlSkip As String
> > Dim tfEnable As Boolean
> >
> >
> > frmAny = Form2
> > strControlSkip = "Text2"
> > tfEnable = False
> >
> > EnableFormControls frmAny, strControlSkip, tfEnable
> > End Sub
> >
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 6:00:01 PM
|
|
"Pastor Del" <PastorDel@discussions.microsoft.com> wrote in message
news:6C39C27D-AD9A-45FF-934E-2CE83F30DF9C@microsoft.com...
> The form was open and I tried 'frmAny = Forms!Form2' without success.
My bad. Apologies. The line should read:
Set frmAny = Forms!Form2
When you're assigning an object, such as a form or report to a variable, you
need to use the Set keyword.
|
|
0
|
|
|
|
Reply
|
Stuart
|
2/17/2010 6:23:30 PM
|
|
>>I tried 'frmAny = Me' without success.<< is not very helpful in determining
the problem. There may be other problems which are preventing it from
working. However: -
Sub EnableFormControls(frmAny As Form, _
strControlSkip As String, _
Optional tfEnable As Boolean = True)
is expecting a reference (pointer) to be passed to it and Me should refer to
the Form in which Private Sub Command1_Click() is running. Since Private Sub
Command1_Click() is running, and doesn’t close the Form, then the Form must
be open and Me must be valid.
I did not test Sub EnableFormControls at all but it does, as written,
require a reference to a Form, not its name. If you are trying to use it on a
sub Form from a parent Form then pass a reference to the sub Form with
Me.YourSubFormControlNameGoesHere.Form. That also is untested.
More information about the failure is required, please.
--
A nod is as good as a wink to a blind horse.
"Pastor Del" wrote:
> I tried 'frmAny = Me' without success. DrGUI suggests that I try passing the
> name as a string. I'll probably go that way because I know I can pass a
> string, but for the sake of greater understanding I'd like to know why I
> can't pass it as a form. Any ideas?
>
> "ChrisO" wrote:
>
> > You could also try: -
> > frmAny = Me
> >
> > --
> > A nod is as good as a wink to a blind horse.
> >
> >
> > "Pastor Del" wrote:
> >
> > > I found this code (EnableFormControls) in the forum to enable/disable
> > > controls on a form but I'm having trouble setting the variable 'frmAny' and
> > > passing it to the sub EnableFormControls. What am I doing wrong?
> > >
> > > Sub EnableFormControls(frmAny As Form, _
> > > strControlSkip As String, _
> > > Optional tfEnable As Boolean = True)
> > > Dim ctlAny As Control
> > > On Error GoTo ERROR_Handler
> > > frmAny(strControlSkip).SetFocus
> > > For Each ctlAny In frmAny.Controls
> > > If ctlAny.Name <> strControlSkip Then
> > > Select Case ctlAny.ControlType
> > > Case acCheckBox, acComboBox, acCommandButton _
> > > , acListBox, acOptionGroup, acSubform _
> > > , acTextBox, acToggleButton
> > > ctlAny.Enabled = tfEnable
> > > End Select
> > > End If
> > > Next ctlAny
> > > Exit Sub
> > >
> > > ERROR_Handler:
> > > If Err.Number = 2164 Then
> > > Resume Next
> > > Else
> > > MsgBox Err.Number & ": " & Err.Description, , _
> > > "Error in EnableFormControls"
> > > End If
> > > End Sub
> > >
> > > Private Sub Command1_Click()
> > > Dim frmAny As Form
> > > Dim strControlSkip As String
> > > Dim tfEnable As Boolean
> > >
> > >
> > > frmAny = Form2
> > > strControlSkip = "Text2"
> > > tfEnable = False
> > >
> > > EnableFormControls frmAny, strControlSkip, tfEnable
> > > End Sub
> > >
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 6:53:02 PM
|
|
Stuart pointed out my problem. When you're assigning an object, such as a
form or report to a variable, you need to use the Set keyword. The code I
initially posted works great when the Set keyword in used.
Thanks for you time and attention
"ChrisO" wrote:
> >>I tried 'frmAny = Me' without success.<< is not very helpful in determining
> the problem. There may be other problems which are preventing it from
> working. However: -
>
> Sub EnableFormControls(frmAny As Form, _
> strControlSkip As String, _
> Optional tfEnable As Boolean = True)
>
> is expecting a reference (pointer) to be passed to it and Me should refer to
> the Form in which Private Sub Command1_Click() is running. Since Private Sub
> Command1_Click() is running, and doesn’t close the Form, then the Form must
> be open and Me must be valid.
>
> I did not test Sub EnableFormControls at all but it does, as written,
> require a reference to a Form, not its name. If you are trying to use it on a
> sub Form from a parent Form then pass a reference to the sub Form with
> Me.YourSubFormControlNameGoesHere.Form. That also is untested.
>
> More information about the failure is required, please.
>
> --
> A nod is as good as a wink to a blind horse.
>
>
> "Pastor Del" wrote:
>
> > I tried 'frmAny = Me' without success. DrGUI suggests that I try passing the
> > name as a string. I'll probably go that way because I know I can pass a
> > string, but for the sake of greater understanding I'd like to know why I
> > can't pass it as a form. Any ideas?
> >
> > "ChrisO" wrote:
> >
> > > You could also try: -
> > > frmAny = Me
> > >
> > > --
> > > A nod is as good as a wink to a blind horse.
> > >
> > >
> > > "Pastor Del" wrote:
> > >
> > > > I found this code (EnableFormControls) in the forum to enable/disable
> > > > controls on a form but I'm having trouble setting the variable 'frmAny' and
> > > > passing it to the sub EnableFormControls. What am I doing wrong?
> > > >
> > > > Sub EnableFormControls(frmAny As Form, _
> > > > strControlSkip As String, _
> > > > Optional tfEnable As Boolean = True)
> > > > Dim ctlAny As Control
> > > > On Error GoTo ERROR_Handler
> > > > frmAny(strControlSkip).SetFocus
> > > > For Each ctlAny In frmAny.Controls
> > > > If ctlAny.Name <> strControlSkip Then
> > > > Select Case ctlAny.ControlType
> > > > Case acCheckBox, acComboBox, acCommandButton _
> > > > , acListBox, acOptionGroup, acSubform _
> > > > , acTextBox, acToggleButton
> > > > ctlAny.Enabled = tfEnable
> > > > End Select
> > > > End If
> > > > Next ctlAny
> > > > Exit Sub
> > > >
> > > > ERROR_Handler:
> > > > If Err.Number = 2164 Then
> > > > Resume Next
> > > > Else
> > > > MsgBox Err.Number & ": " & Err.Description, , _
> > > > "Error in EnableFormControls"
> > > > End If
> > > > End Sub
> > > >
> > > > Private Sub Command1_Click()
> > > > Dim frmAny As Form
> > > > Dim strControlSkip As String
> > > > Dim tfEnable As Boolean
> > > >
> > > >
> > > > frmAny = Form2
> > > > strControlSkip = "Text2"
> > > > tfEnable = False
> > > >
> > > > EnableFormControls frmAny, strControlSkip, tfEnable
> > > > End Sub
> > > >
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 7:25:01 PM
|
|
Thanks, it works great with the Set keyword. I'm self-taught and had not
come across this kind of situation before. Thanks again.
"Stuart McCall" wrote:
> "Pastor Del" <PastorDel@discussions.microsoft.com> wrote in message
> news:6C39C27D-AD9A-45FF-934E-2CE83F30DF9C@microsoft.com...
> > The form was open and I tried 'frmAny = Forms!Form2' without success.
>
> My bad. Apologies. The line should read:
>
> Set frmAny = Forms!Form2
>
> When you're assigning an object, such as a form or report to a variable, you
> need to use the Set keyword.
>
>
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 7:27:01 PM
|
|
Yes, Stuart is correct and I should have tested the code.
As a matter of interest: -
Private Sub Command1_Click()
Dim frmAny As Form
Dim strControlSkip As String
Dim tfEnable As Boolean
Set frmAny = Me
strControlSkip = "Text2"
tfEnable = False
EnableFormControls frmAny, strControlSkip, tfEnable
End Sub
can be reduced to: -
Private Sub Command1_Click()
EnableFormControls Me, "Text2", False
End Sub
which removes the problem.
--
A nod is as good as a wink to a blind horse.
"Pastor Del" wrote:
> Stuart pointed out my problem. When you're assigning an object, such as a
> form or report to a variable, you need to use the Set keyword. The code I
> initially posted works great when the Set keyword in used.
>
> Thanks for you time and attention
>
>
> "ChrisO" wrote:
>
> > >>I tried 'frmAny = Me' without success.<< is not very helpful in determining
> > the problem. There may be other problems which are preventing it from
> > working. However: -
> >
> > Sub EnableFormControls(frmAny As Form, _
> > strControlSkip As String, _
> > Optional tfEnable As Boolean = True)
> >
> > is expecting a reference (pointer) to be passed to it and Me should refer to
> > the Form in which Private Sub Command1_Click() is running. Since Private Sub
> > Command1_Click() is running, and doesn’t close the Form, then the Form must
> > be open and Me must be valid.
> >
> > I did not test Sub EnableFormControls at all but it does, as written,
> > require a reference to a Form, not its name. If you are trying to use it on a
> > sub Form from a parent Form then pass a reference to the sub Form with
> > Me.YourSubFormControlNameGoesHere.Form. That also is untested.
> >
> > More information about the failure is required, please.
> >
> > --
> > A nod is as good as a wink to a blind horse.
> >
> >
> > "Pastor Del" wrote:
> >
> > > I tried 'frmAny = Me' without success. DrGUI suggests that I try passing the
> > > name as a string. I'll probably go that way because I know I can pass a
> > > string, but for the sake of greater understanding I'd like to know why I
> > > can't pass it as a form. Any ideas?
> > >
> > > "ChrisO" wrote:
> > >
> > > > You could also try: -
> > > > frmAny = Me
> > > >
> > > > --
> > > > A nod is as good as a wink to a blind horse.
> > > >
> > > >
> > > > "Pastor Del" wrote:
> > > >
> > > > > I found this code (EnableFormControls) in the forum to enable/disable
> > > > > controls on a form but I'm having trouble setting the variable 'frmAny' and
> > > > > passing it to the sub EnableFormControls. What am I doing wrong?
> > > > >
> > > > > Sub EnableFormControls(frmAny As Form, _
> > > > > strControlSkip As String, _
> > > > > Optional tfEnable As Boolean = True)
> > > > > Dim ctlAny As Control
> > > > > On Error GoTo ERROR_Handler
> > > > > frmAny(strControlSkip).SetFocus
> > > > > For Each ctlAny In frmAny.Controls
> > > > > If ctlAny.Name <> strControlSkip Then
> > > > > Select Case ctlAny.ControlType
> > > > > Case acCheckBox, acComboBox, acCommandButton _
> > > > > , acListBox, acOptionGroup, acSubform _
> > > > > , acTextBox, acToggleButton
> > > > > ctlAny.Enabled = tfEnable
> > > > > End Select
> > > > > End If
> > > > > Next ctlAny
> > > > > Exit Sub
> > > > >
> > > > > ERROR_Handler:
> > > > > If Err.Number = 2164 Then
> > > > > Resume Next
> > > > > Else
> > > > > MsgBox Err.Number & ": " & Err.Description, , _
> > > > > "Error in EnableFormControls"
> > > > > End If
> > > > > End Sub
> > > > >
> > > > > Private Sub Command1_Click()
> > > > > Dim frmAny As Form
> > > > > Dim strControlSkip As String
> > > > > Dim tfEnable As Boolean
> > > > >
> > > > >
> > > > > frmAny = Form2
> > > > > strControlSkip = "Text2"
> > > > > tfEnable = False
> > > > >
> > > > > EnableFormControls frmAny, strControlSkip, tfEnable
> > > > > End Sub
> > > > >
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 9:00:01 PM
|
|
|
11 Replies
239 Views
(page loaded in 0.302 seconds)
Similiar Articles: how to pass form name to a module? - microsoft.public.access ...Greeting, I want to display the current form name when clicke on a button in the form, but I want to use a module for that? any help please!!! ... Pass name of control to a form - microsoft.public.access ...How do I pass the name of a control on Form_A to Form_B? For example: I have a hidden control in Form_A named ControlA1_ID, I want to pass the name... Form Name as Variable - microsoft.public.access.modulesdaovba ...Is there a way I can pass a form name to Sub SetMeter e.g. so its first line is Public Sub SetMeterBasic(p As Single, FormName as String) where the variable FormName ... Passing form value to hyperlink address - microsoft.public.access ...... it will link to the document at C:\Data\ and whatever file name is ... public.access ... passing record number to a form ... Passing form value to hyperlink ... How To Pass ... passing a control to a sub - microsoft.public.access.modulesdaovba ...Is there a way I can pass a form name to Sub SetMeter e.g. so its first line is ... Pass name of control to a form - microsoft.public.access ... Passing a variable to ... passing a variable to a report - microsoft.public.access.forms ...hello, I have a report that shows the detail for 3 different values of a field named "TransType": (values: pmt, adj, act). The name, date, and Tra... Passing query parameters thru form - microsoft.public.access.forms ...DoCmd.Close acForm, Me.Name DoCmd.OpenForm "metrixDataTbl ... How to Pass Data From a Form Into a Query Access | eHow.com How to Pass Data From a Form Into a ... SSRS Advance Services and passing parameters via <form> ...Email(not shown): Name: | ... Source Using SQL Server Reporting Services ... ... to Stored Procedure in Reporting Services. ... them onto the report form. ... How to pass ... Passing data between forms Access 2000 - microsoft.public.access ...Pass name of control to a form - microsoft.public.access ... Using a module to control multiple Forms ... ... Ged Mead walks you through a simple way of passing data ... Passing the value of a Combobox to another field. - microsoft ...I have a combo box ("ComboLineDefault") that is looking at table "ProductionLines" which has 2 fields (Record ID and Name" The combo box shows ... How to pass a value from a from to a Email sending VBA module ...how to pass form name to a module? - microsoft.public.access ... How to pass a value from a from to a Email sending VBA module ... how to pass form name to a module ... ADP PARAMETERS - microsoft.public.access.queriesWe experienced the same problem. The solution ... We are running SQL Server 2008 Reporting Services in ... Re: Passing Active Form Name to Report Input Parameter (ADP ... Form OpenArgs and ComboBox - microsoft.public.access.forms ...how to pass form name to a module? - microsoft.public.access ... Greeting, I want to display the current form name when clicke on a button in the form, but I want to use a ... Passing a value from subform or main form to subform query ...Typically, it >> because there is a misspelled name somewhere in ... Passing a value from subform or main form to subform query ... how to pass data from pop up form ... Passing variable from quote form to crystal report - microsoft ...... viewer.csp?id=xxx > > yourParam is the crystal report parameter name. eg ... Variable To Crystal Report At Run Time I'm running Crystal Report. ... Passing Value From Form ... Passing Userform Control to Subroutine - microsoft.public.excel ...Passing Userform Control to Subroutine - microsoft.public.excel ... Pass name of control to a form - microsoft.public.access ... I don't know how to pass the control name ... Value Cannot be Null. Parameter name: format - microsoft.public ...null value pass from form into query - microsoft.public.access ... Cannot pass Null value for parameter ??? - microsoft.public.dotnet ... Using global variables to ... Using a module to control multiple Forms' events - microsoft ...how to pass form name to a module? - microsoft.public.access ... Using a module to control multiple Forms' events - microsoft ... Pass name of control to a form ... Call Public Sub in a SubForm - microsoft.public.access.formscoding ...This can cause some challenges, because you can no longer refer to the form as Me, but this is relatively easy to overcome by passing the form or the form name to the ... passing operator as variable - microsoft.public.access.formscoding ...Hi, I have a form for Importing parts lists into my ... of Comboboxes so the user can select column name ... the selected calculations, but I can't figure out how to pass ... Passing form name DataBase - DataBase Discussion List Wednesday ...I found this code (EnableFormControls) in the forum to enable/disable controls on a form but I am having trouble setting the variable 'frmAny' and passing Passing form name to JavaScript functionTweet I need to pass a form name to a JavaScript function so that I can call that ... Tweet function SubmitForm( formname )<BR>{<BR> ... maybe do ... Passing form name JavaScript and AJAX forum at WebmasterWorldPassing form name: thaedge msg:1476438 8:52 pm on Aug 23, 2004 (gmt 0) Its been awhile since Ive done JS and I'm having a bit of a brain fart and am unable of finding ... Passing the Form Object as a Parameter : Function « Language ...Passing the Form Object as a Parameter : Function « Language Basics « JavaScript DHTML ... FORM NAME="Abbey Road"> Choose your favorite Beatle: <INPUT TYPE="radio" NAME= ... how to pass form name to a module? DataBaseGreeting, I want to display the current form name when clicke on a button in the form, but I want to use a module for that any help please!!!? [Javascript] Passing form name to functionNo need to use eval when the forms collection can, and in my opinion, should be referenced. fuction postForm(formName){ var objForm = document.forms[formName ... How to pass form and field names to a function - Dev ArticlesHow to pass form and field names to a function- JavaScript Development. Visit Dev Articles to discuss How to pass form and field names to a function Pass form name and value to a function - JavaScript / Ajax / DHTMLPass form name and value to a function. JavaScript / Ajax / DHTML Forums on Bytes. Passing a Form Object and Form Element to Functions : Form HTML ...Passing a Form Object and Form Element to Functions : Form HTML « Form Control ... return false"> Choose your favorite Beatle: <INPUT TYPE="radio" NAME="CheckBoxes" ... [RESOLVED] Problem passing form name in Chrome and Firefox, not ...Client-Side Development > JavaScript ... Hi there, I am using dynamically generated forms with (unknown) unique names and id's ... Code: <!DOCTYPE html PUBLIC "-//W3C ... 7/18/2012 10:26:55 PM
|