Record Editing - Another question

R

remmons

I'm sorry, I have one more issue regarding this post. As the code begins to
loop
through the controls, the control on the subform that has the focus will not
allow me to change its enabled property. I tried creating a dummy control
and setting the focus to that but that doesn't seem to work either. I may be
being too particular about this but, I have several subforms and I'm trying
not to have to fully qualify each subform before running the for each loop to
search for the tag property on the controls. Here's a little snippet of the
code I'm using:
frmEditProjects is the form, frmProjects is the first subform, and the
tabcontrol resides there with more subforms on each tab. By the way, there
are a couple of subforms within those subforms.

Dim ctl As Control
Dim subctl As Control
Dim nextsubctl As Control
Dim strSubFormName As String
Dim strNextSubFormName As String

For Each ctl In Form_frmProjects.Controls
If ctl.Tag = "LockMe" Then
Form_frmProjects.TxtSetFocus.SetFocus
ctl.Locked = True
ctl.Enabled = False
End If
Select Case ctl.ControlType
Case acSubform
strSubFormName = ctl.Name
ctl.SetFocus
For Each subctl In
Form_frmEditProjects.frmProjects.Form(strSubFormName).Controls
If subctl.Tag = "LockMe" Then
subctl.Locked = True
subctl.Enabled = False
End If
Select Case subctl.ControlType
Case acSubform
subctl.SetFocus
strNextSubFormName = subctl.Name
For Each nextsubctl In
Form_frmProjects.Form(strSubFormName).Form(strNextSubFormName).Controls
'For Each subthreectl In
Form_frmEditProjects.frmProjects.Form(strSubFormName).Form(strNextSubFormName).Controls
If nextsubctl.Tag = "LockMe" Then
nextsubctl.Locked = True
nextsubctl.Enabled = False
End If
Next nextsubctl
End Select
Next subctl
End Select
Next ctl
End Sub
 
A

a a r o n . k e m p f

you're on the right track-- set the focus somewhere else to disable
the control
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top