error '2164' can't disable a control while it has the focus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I got the following error msg while i try to disable a control from a
different form's close event.
"error '2164' can't disable a control while it has the focus"

Here is a part of the code:

Private Sub Form_Close()

DoCmd.Save acForm, Me.Form.Name
If CurrentProject.AllForms("FrmRocks").IsLoaded Then
If gbIsDirty Then
Forms.frmrocks.CmbRockName.Requery
Forms.frmrocks.subFrmRocksDetails.Enabled = True
Else
Forms.frmrocks.subFrmRocksDetails.Enabled = False @@@@<-problems
End If
Forms.frmrocks.CmbRockName.Value = gsRockName
gbIsDirty = False
End If

Please help.

Jeff
End Sub
 
.....shift the focus to an inocous control just before disableing your
control

MyOtherControl.SetFocus

peter walker
 
Back
Top