• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2684
  • Last Modified:

How to resolve Run-time error "2165", You can't hide a control that has the focus?

I am developing an Access 2003 MDB type application with SQL Server as the Back end database.

My application uses 5 tabs as follows:

Misc
UDL_Remediate
UDL_1099
Page856
Page851

I have the user log onto my system and assign the user access rights.
The access rights are stored in a field name strUSERRIGHTS.
In the form load, I use the following logic:

If strUSERRIGHTS = "V" Then
    Me.Page851.SetFocus
    Misc.Visible = False
    UDL_Remediate.Visible = False   <----- Compile error  Run time error '2165'
    UDL_1099.Visible = False
    Page856.Visible = False
End If

When the compiler reaches the line UDL_Remediate.Visible = False,
the system displays the following:

Run-time error '2165':
You can't hide a control that has the focus

Do you know how I can resolve this error?


0
zimmer9
Asked:
zimmer9
1 Solution
 
Rey Obrero (Capricorn1)Commented:
you have to move the focus to a control that will not be hidden

me.controlName.setfocus

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now