Run time error 2165

Ty Gooden

New member
Local time
Today, 20:05
Joined
Jul 31, 2009
Messages
4
I'm having a problem which is driving me mad! I'm trying to make a field on a subform become invisible depending on the selection in a combo box on the main form.

I sometimes get run time error 2165 'You can't hide a contol that has the focus' even though I've included a line of code that moves the focus onto the main form. Does anyone have any ideas? This error doesn't occur all the time.

Private Sub cmbReasonForDeallocation_AfterUpdate()

Forms!frmTokenDeallocation!Date_Unallocated.SetFocus

If Me!cmbReasonForDeallocation.Value = "Returned by user" Then
subfrmTokenDeallocation!Status.Value = "Unallocated"
Forms!frmTokenDeallocation!subfrmTokenDeallocation!
DateRetired.Visible = False

Else
subfrmTokenDeallocation!Status.Value = cmbReasonForDeallocation
subfrmTokenDeallocation!DateRetired.Visible = True
End If


End Sub
 

Users who are viewing this thread

Back
Top Bottom