Hello, I have a Form with the following four fields - JPGA, JPGB, JPGC and JPGD. The tab sequence for these four fields is 1, 2, 3 and 4 respectively. I use the ‘AfterUpdate’ event procedure to do some data validation and when I find an error I want to be able to focus the cursor back to the field that is in error.
So for example if I validate JPGB and find an error I will code the following statement…
If JPGBerror = “Y” Then
Me.JPGB.Setfocus
Exit Sub
End If
When this statement is executed the cursor goes to JPGC (not JPGB). Also, if I code the following statement as a test…
If JPGBerror = “Y” Then
Me.JPGD.Setfocus
Exit Sub
End If
The cursor will correctly go to JPGD. So my question is, how can I get the Setfocus command to work if I want to tab back to the field in error? Thank you for your time.
So for example if I validate JPGB and find an error I will code the following statement…
If JPGBerror = “Y” Then
Me.JPGB.Setfocus
Exit Sub
End If
When this statement is executed the cursor goes to JPGC (not JPGB). Also, if I code the following statement as a test…
If JPGBerror = “Y” Then
Me.JPGD.Setfocus
Exit Sub
End If
The cursor will correctly go to JPGD. So my question is, how can I get the Setfocus command to work if I want to tab back to the field in error? Thank you for your time.