Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Got Focus and on Click little bug

Status
Not open for further replies.

vttech

Technical User
Jan 28, 2006
297
US
I am trying to perform a Function when ever someone clicks_on or tabs to a text box
So I set the following on the event Tab

On Got Focus = Calendarfor([txtDOB])
on Click = Calendarfor([txtDOB])

The tab part works great but if the user click on the text box first then it calls the function twice

I know the reason is that if the user clicks the text box first access it saying that
Got Focus and Click events are triggered thus it runs the function twice.

How can I prevent the function from executing twice when a user clicks on the text box first??


Newbie in search of knowledge
 
Greetings,

I would say just have the onfocus event trigger the event. As you said, when the user clicks on the text box, the onfocus happens, then the onclick happens thereby triggering the event twice. No matter how the user gets to the text box (click, tab, etc), the onfocus will happen.

Unless I've misunderstood, you've kind of answered your question when you said that by clicking both events happen.

Hope this works for you.

"If you say you can, or you say you can't, you're right!"
-- Henry Ford
 
Clicking on the text box gives the focus to that box, which executes the on got focus procedure. There shouldn't be a need to have Calendarfor([txtDOB]) in both procedures.

---------------------------------------
Bob Beck
Systems Administrator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top