D
Dave180
MSA 2003
SETFOCUS - Fails 2165
-------------------------
Forms!frmmaster = the form
forms!frmmaster!mysubform = a subform on the master form
"ctlControlObject.Name = strBUT" equates to a reference of the 'control
array' in the subform
The subform has 100 controls - The Master form has a Restart and Close
control and some labels
I use the following code segment called when the Master form is opened and
also when the RESTART Control is clicked on the Master Form.
In both instances the calling code has been told to loop to this segment (if
conditions are correct) 10 times
-------- Code Segment begin
---------------------------------------------------------
Case Is = "frmINITHideSquares" ' HIDE THE BORDER SQUARES
'' MAKES CMDBUT INVISIBLE
If ctlControlObject.Name = strBUT Then
Forms!frmmaster.CMDClose.SetFocus ' Move focus away from
CMD ' can't hide it else
With ctlControlObject
.Tag = "B"
' On Error Resume Next ' SOMETIMES!?! The
Control still has the focus (despite .setfocus)
' Forms!frmmaster!CMDClose.SetFocus ' Move focus away
from CMD ' can't hide it else
' On Error GoTo errtrap ' SOMETIMES!?! The
Control still has the focus (despite .setfocus)
.Visible = 0 <<<<<<< HERE 2165 ERR
End With
End If
-------- Code Segment end
--------------------------------------------------------------
Occassionally! I get a 2165 error in the line trying to hide a control on
the subform despite having forced the focus away to a control on the 'master'
form.
As you can see from the commented out lines in the loop - I've tried a few
solutions to trap this. - I failed!
Is this a hardware thing? - I'm running my APP on a fast PC
Could the PC be running faster than MSA can move the focus away from the
Control I'm trying to hide?
The 2165 error appears NOT to occur on 'Form Load' - but only (and then
sometimes only) when the RESTART routine is executed.
(As stated - both 'Form Load' and 'Restart' events use the same code.
Any advice as to how to prevent this err occuring will be gratefully
appreciated.
Regards,
Dave
(I'm not Dumb - It's just the way I walk!)
SETFOCUS - Fails 2165
-------------------------
Forms!frmmaster = the form
forms!frmmaster!mysubform = a subform on the master form
"ctlControlObject.Name = strBUT" equates to a reference of the 'control
array' in the subform
The subform has 100 controls - The Master form has a Restart and Close
control and some labels
I use the following code segment called when the Master form is opened and
also when the RESTART Control is clicked on the Master Form.
In both instances the calling code has been told to loop to this segment (if
conditions are correct) 10 times
-------- Code Segment begin
---------------------------------------------------------
Case Is = "frmINITHideSquares" ' HIDE THE BORDER SQUARES
'' MAKES CMDBUT INVISIBLE
If ctlControlObject.Name = strBUT Then
Forms!frmmaster.CMDClose.SetFocus ' Move focus away from
CMD ' can't hide it else
With ctlControlObject
.Tag = "B"
' On Error Resume Next ' SOMETIMES!?! The
Control still has the focus (despite .setfocus)
' Forms!frmmaster!CMDClose.SetFocus ' Move focus away
from CMD ' can't hide it else
' On Error GoTo errtrap ' SOMETIMES!?! The
Control still has the focus (despite .setfocus)
.Visible = 0 <<<<<<< HERE 2165 ERR
End With
End If
-------- Code Segment end
--------------------------------------------------------------
Occassionally! I get a 2165 error in the line trying to hide a control on
the subform despite having forced the focus away to a control on the 'master'
form.
As you can see from the commented out lines in the loop - I've tried a few
solutions to trap this. - I failed!
Is this a hardware thing? - I'm running my APP on a fast PC
Could the PC be running faster than MSA can move the focus away from the
Control I'm trying to hide?
The 2165 error appears NOT to occur on 'Form Load' - but only (and then
sometimes only) when the RESTART routine is executed.
(As stated - both 'Form Load' and 'Restart' events use the same code.
Any advice as to how to prevent this err occuring will be gratefully
appreciated.
Regards,
Dave
(I'm not Dumb - It's just the way I walk!)