Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does Userform freezes after hiding and showing it multiple times
    text
    copied!<p>Ok, i have question on hiding and showing userforms.<br> <a href="https://stackoverflow.com/questions/20068412/how-to-go-back-display-userform-after-hiding-it/20068820?noredirect=1#20068820">This link</a> already answered it for me.<br></p> <p>Problem is I encounter another problem.<br> When I go back to <code>Userform1</code> it freezes and I can't do anything at all.<br> Why? Do i need to add something in the code?</p> <p><strong>Heres the summay of the code i used:</strong><br> This code prompts user to enter username and password</p> <pre><code>Option Explicit Private Sub CBu_Login_Click() Dim ws As Worksheet, rng As Range, lrow As Long, find_value As String Dim cel As Range Set ws = ThisWorkbook.Sheets("UserName") lrow = ws.Range("A" &amp; ws.Rows.Count).End(xlUp).Row Set rng = ws.Range("A2:A" &amp; lrow) find_value = Me.TB_Username.Value Set cel = rng.Find(What:=find_value, After:=ws.Range("A2"), LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Not cel Is Nothing Then If Me.TB_Password.Value = cel.Offset(0, 1).Value Then Me.Hide UF_Encoding.L_User.Caption = "Welcome " &amp; cel.Offset(0, 2).Value &amp; "!" &amp; " You are logged in." UF_Encoding.TB_Operator.Text = cel.Offset(0, 2).Value UF_Encoding.TB_ESN_IMEI.Value = "" UF_Encoding.CB_PrimaryCode.Value = "" UF_Encoding.CB_SecondaryCode.Value = "" UF_Encoding.TB_Remarks.Value = "" UF_Encoding.TB_ESN_IMEI.SetFocus UF_Encoding.Show Else MsgBox "Invalid Username/Password" End If Else MsgBox "Invalid Username/Password" End If End Sub </code></pre> <p><strong>This code is for logging out:</strong><br> I used Listbox here so the user can select which action to take.</p> <pre><code>Private Sub LB_Options_AfterUpdate() If Me.LB_Options.Value = "Log out" Then Me.Hide Me.LB_Options.Visible = False UF_Login.TB_Username.Value = "" UF_Login.TB_Password.Value = "" UF_Login.Show ElseIf Me.LB_Options.Value = "Change Password" Then Me.Hide Me.LB_Options.Visible = False UF_Changepass.TB_User.Value = "" UF_Changepass.TB_Newpass.Value = "" UF_Changepass.TB_Oldpass.Value = "" UF_Changepass.Show ElseIf Me.LB_Options.Value = "Exit" Then Me.Hide wbDbase.Save wbDbase.Close wbEncoding.Save wbEncoding.Close Unload UF_Login Unload UF_Changepass Unload Me End If </code></pre> <p>Well this does what i wan't. Log in, log out, change pass and exit.<br> But as I've, said the Forms freezes after 1st execution.<br></p> <p><strong>Example:</strong><br> 1. I initialize UF_Login and then UF_Encoding appears.<br> 2. It works, all commandbuttons and text boxes works.<br> 3. Then I log out using the list box.<br> 4. When i log in again, it will show UF_Encoding but when i try to use the commanb buttons and text boxes, it doesn't work.<br> 5. Strange thing is that the list box with log out, change pass and exit works.</p> <p>I'm really having a hard time figuring out why.<br> Any help is appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload