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
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