mloucel
Member
- Local time
- Yesterday, 20:39
- Joined
- Aug 5, 2020
- Messages
- 309
I use the following workaround:
Before setting the focus to the current control, set the focus to another control, it doesn't matter which one.
Example:
Code:Private Sub AuthDateEntered_LostFocus() 'Private Sub AuthDateEntered_BeforeUpdate(Cancel As Integer) If AuthDateEntered < ReferDate Then Me.AuthDateEntered.BorderColor = vbRed MsgBox "This date cannot be before the referral date" & _ vbCrLf & _ "Please Correct before continue", vbCritical + vbOKOnly, "Error detected" DoEvents 'Cancel = True Me!OTHERCONTROL.SetFocus Me!AuthDateEntered.SetFocus DoCmd.CancelEvent Else Me.AuthDateEntered.BorderColor = RGB(166, 166, 166) [QUOTE="CJ_London, post: 1923417, member: 117916"] before update the AuthDateEntered control will hold the previous value. You need to use the .text property [CODE]Private Sub AuthDateEntered_BeforeUpdate(Cancel As Integer) If AuthDateEntered.text < ReferDate Then
since these are dates and the control is text, you may need
if cDate(AuthDateEntered.text)< ReferDate then
End If
End Sub[/CODE]
In this case, I set the focus to the OTHERCONTROL control before resetting it to the AuthDateEntered control.
[/QUOTE]
SIR.. Hats Off to you
IT WORKED..
Just the way I wanted it, this is pure genius, thank you so much, I set the focus first to ReferDate, followed with the ADE, it works..
PROBLEM SOLVED..