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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to keep focus on a text box after the 'after update' event 1

Status
Not open for further replies.

VictoriaWass

Programmer
Jul 14, 2001
12
0
0
GB
If a user enters text into a text box, we check in the 'after update' event that it fits the criteria required. If it doesn't, how do we force the focus back onto the same text box to make them re-enter?
At the moment, the focus is moving to the next tab stop, even with a command in the 'after update' event to setfocus back onto this text box.

Thanks
 
I've done this many times, although it's probably not the most elegant solution. Put your criteria checking in the OnEnter event of the next control in the tab order. If it fails, send the focus to your previous text box.
 
another not so clean way is to turn off paint and reset focus to that control...It has been a while but I believe it is docmd.paint or repaint true and false and .SetFocus
 
Hi!

You have your code in the wrong event procedure. Compare the entry to the criteria in the before update procedure. If the the entry doesn't fit the criteria then set cancel=-1 (true). This will automatically keep the focus on the textbox.

hth
Jeff Bridgham
 
Hi All

sorry if this is a dumb question but I am new to Access VBA!

I am trying to get a report to run which shows records between certain dates ( inputing into a form by a user). The report is based on a crosstab query. I have used the "where" parameter of the query, but it doesnt seem to like it.

However, I have done exactly the same for other non - crosstab reports whcih work fine.

Do crosstab queries not support this?
 
Hi All

sorry if this is a dumb question but I am new to Access VBA!

I am trying to get a report to run which shows records between certain dates ( inputing into a form by a user). The report is based on a crosstab query. I have used the "where" parameter of the query, but it doesnt seem to like it.

However, I have done exactly the same for other non - crosstab reports whcih work fine.

Do crosstab queries not support this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top