Rocky Smolin - Beach Access Software
bchacc at san.rr.com
Sun Mar 9 14:13:01 CST 2003
MessageAndy: Thanks. It seems to be working on some of the fields but not on others. I'll have to see if there's a difference between the two. Rocky ----- Original Message ----- From: Andy Lacey To: accessd at databaseadvisors.com Sent: Sunday, March 09, 2003 11:14 AM Subject: RE: [AccessD] Set Focus On Control When Validation Fails Rocky Have you tried in BeforeUpdate? then you don't need to set focus, just set Cancel to True and it'll stay there. Andy Lacey http://www.minstersystems.co.uk -----Original Message----- From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] On Behalf Of Rocky Smolin - Beach Access Software Sent: 09 March 2003 18:45 To: AccessD at databaseadvisors.com Subject: [AccessD] Set Focus On Control When Validation Fails Dear List I have a couple of simple validation tests: If Not IsNumeric(Nz(txtStartingRoomNumber)) Then MsgBox "Starting Room Number Must Be Numeric.", vbExclamation txtStartingRoomNumber.SetFocus Exit Sub End If If Val(Nz(txtStartingRoomNumber)) > 9999999 Then MsgBox "Starting Room Number Must Be Less Than 7 Digits.", vbExclamation txtStartingRoomNumber.SetFocus Exit Sub End If in the AfterUpdate event of txtStartingRoomNumber. But the SetFocus does not work. The focus ends up being set on the next control in the tab sequence. I tried the tests in the Lost Focus event with the same result. I know there must be a simple way to return the focus to the control but I can't see it. (Maybe I shouldn't work on Sunday but the kids are in Sunday school and it's quiet.) :) MTIA, Rocky Smolin Beach Access Software -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030309/9e08a579/attachment-0001.html>