I have a form with a button on that closes the current form and opens a new form
And it works fine, on the same button I also use the On Mouse Move Event
I also have a function that works with the Mouse Move Function:
My problem is that when I use the button to close the form and open the new one, the Move Mouse Function is still looking for the Form frm_AddToLists, so produces an error.
I guess I need to put some code in the On Click event to stop the On Mouse Move function.
How do I do that please?
Code:
Private Sub btn_AddContact_Click()
On Error GoTo btn_AddContact_Click_Err
DoCmd.OpenForm "frm_Contacts", acNormal, "", "", , acNormal
DoCmd.Close acForm, "frm_AddToLists"
btn_AddContact_Click_Exit:
Exit Sub
btn_AddContact_Click_Err:
MsgBox Error$
Resume btn_AddContact_Click_Exit
End Sub
Code:
Private Sub btn_AddContact_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
ControlTip Me.Name, Me.btn_AddContact.Tag, 1
End Sub
Code:
Private Function ControlTip(ByVal frmName As String, Optional strtext As String = "Welcome User: ", Optional xswitch As Integer = 0)
On Error GoTo ControlTip_Err
With Forms(frmName).Controls("lblTip")
Select Case xswitch
Case 1
If .Caption <> strtext Then
.Caption = strtext
End If
Case Else
If .Caption <> strtext Then
.Caption = strtext & CurrentUser
End If
End Select
End With
ControlTip_Exit:
Exit Function
ControlTip_Err:
MsgBox Err.Description, , "ControlTip()"
Resume ControlTip_Exit
End Function
I guess I need to put some code in the On Click event to stop the On Mouse Move function.
How do I do that please?