Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

OnFocus or OnEnter ?

Posted on 2003-02-25
3
Medium Priority
?
1,104 Views
Last Modified: 2011-04-14
Hi Experts,

I have lots of confusion over OnFocus and OnEnter property of controls.

For example,

I have this control User ID to let user input their ID,
if the ID is in the database, the form will show the description of the person and has to enter the number of times he's here, if not it will prompt the person to enter his description on another Form.

What I have done :-
Show UserID 1st, hide the rest.
If the UserID is in database, unhide the description control set focus to te control he will key in the number of times he visited
else call another form to add his description.
I have another button to allow the user to update his database.

So when the user key in the USerID, I set the check for the data OnLostFocus, but everytime I press the close(x) button, it will prompt me to enter my ID before closing the form.
When I use the onEnter property of the button, it keep setting focus on the Times control !

If you guys out there got a better way to sort out the OnFocus and OnEnter property,

DO advice !

Thanks, LOL
BEGINNER
0
Comment
Question by:happyboy25
  • 2
3 Comments
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 8022398
Whenever you want to run code based on data in a control changing, it is probably best to use the AfterUpdate event of the control.
0
 

Author Comment

by:happyboy25
ID: 8022689
Hi there,

Nice to see you again. :)


That's means that I check the USerID in the AfterUpdate event instead of the onExit ?

What the difference ?

Do Advice
BEGINNER
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 80 total points
ID: 8024024
The OnExit event fires whenever you move out of the control - the AfterUpdate event only fires if the user alters data and then moves away.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question