Hello,
I am new in VBA. I took some codes from one database, but something doesn't work.
In a Form view, on VarB field, on Exit, a function will check a condition. After entering the value of VarB and clicking Enter key, if the condition is false, I want the cursor stays in VarB field. The following code works in the database where I took the codes, but it doesn't work in my database. Could somebody help me check this? Thank you for your time.
If Condition = 6 Then
VarA = VarB
Else
MsgBox "Please do again!"
DoCmd.GoToControl VarB
End If
I am new in VBA. I took some codes from one database, but something doesn't work.
In a Form view, on VarB field, on Exit, a function will check a condition. After entering the value of VarB and clicking Enter key, if the condition is false, I want the cursor stays in VarB field. The following code works in the database where I took the codes, but it doesn't work in my database. Could somebody help me check this? Thank you for your time.
If Condition = 6 Then
VarA = VarB
Else
MsgBox "Please do again!"
DoCmd.GoToControl VarB
End If