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

cases where setFocus( ) does not work?

Status
Not open for further replies.

bkatz

IS-IT--Management
Jun 16, 2002
7
US
Hello,

There seem to be a few places in MSAccess VBA where setFocus(), applied to a control, just won't work like you'd expect it should.

For instance in BeforeUpdate(), I actually get a VBA error stating that I need "to save the control" before using this method.

in AfterUpdate(), I get no such explicit error, but setFocus() is ignored.

Any pointers on this? Thanks...

 
It could be that SetFocus is not being ignored, but occurs before a tab order is executed in which case the SetFocus would be executed but invisible because focus would subsequently move to the next control in the tab order.

Moving the focus around on an Access form can be challenging and quite frustrating. I recommend copious applications of good brandy.

Cheers,
 

Turns out I could get it to work by FIRST moving OFF of the control, and then moving back to the control. There must be some weird data conflict going on in the Access background??

works:

private sub txtData1_Event()
' . . .
txtData2.setFocus
txtData1.setFocus
' . . .
end sub

Doesn't work:

private sub txtData1_Event()
' . . .
txtData1.setFocus
' . . .
end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top