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

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
 
P

peter walker

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

MyOtherControl.SetFocus

peter walker
 

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