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

Why the lost focus function for the form doesn't work?

i write the lost focus function for a form. but it doesn't work at all, when i switch to other form (lost focus of the form), it doesn't run the commands in private sub form_lostfocus()

does anybody know why?
0
ppingshi
Asked:
ppingshi
1 Solution
 
PaurthsCommented:
hi ppingshi

try the  onDeactivate-event of the form...

Private Sub Form_Deactivate()
    MsgBox Me.Name & " wordt gedeactiveerd"
End Sub

cheers
Ricky
0
 
PaurthsCommented:
might be better in english...

Private Sub Form_Deactivate()
   MsgBox Me.Name & " is being deactivated..."
End Sub
0
 
PaurthsCommented:
btw, a form can only receive focus when there are no controls (objects) on the form, or when all visible controls on it are disabled.
Thus, if u click a button to go to another form, the actual form will not lose focus, since it did not have the focus. (So no LostFocus event is triggered)

hope this clears things up,

cheers
Ricky
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
nico5038Commented:
The pop-up type of form doesn't work properly on the events, perhaps that's the case with your form?

Nic;o)
0
 
amp072397Commented:
ppingshi:

Just a friendly reminder to stay active in your question.

thanks!
amp
community support moderator

7/26
0
 
NetminderCommented:
Per recommendation, force-accepted by
Netminder
CS Moderator
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

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