Question : SetFocus after validate textbox, not working

Hi Guys

For some reason SetFocus is not working, it goes to the next control

Private Sub DateOfBirth_AfterUpdate()
If Not IsNull(Me.DateOfDeath) Then
    If Me.DateOfBirth >= Me.DateOfBirth Then
        MsgBox "Date of Birth must be smaller than Date of Death", , "Date Of Birth"
        Me.DateOfBirth.Value = ""
        Me.DateOfBirth.SetFocus
    End If
End If
End Sub

Any thoughts

BEst regards

Answer : SetFocus after validate textbox, not working

Also ... as a side note ... I see this at lot being posted by experts et.al:

Me.DateOfBirth.Value = ""    ' (setting to empty string).

However, if that field in the table has its Allow Zero Length String property set to NO (which it SHOULD - see reference below, although sadly, the Default is YES) ... this is going to cause an error.  

However, this:

Me.DateOfBirth.Value = Null

will never cause an error.

Here is the reference to the ZLS issue:

http://allenbrowne.com/bug-09.html

scroll down to Zero Length String

mx
Random Solutions  
 
programming4us programming4us