Hello,
I use the following function to compare a value(FieldDouble) in B Database to aother value(FieldOrig) in a linked table from A Database. If the FieldDouble is entered differently from FieldOrig, I want the focus stays in FieldDouble.
Neither FieldDouble.SetFocus nor DoCmd.GoToControl VarDouble works. The cursor still goes to the next field without error message. SendKeys "{TAB}", False takes the cursor to the second field after FieldDouble. Can somebody help me fix this problem?
Public Function Compare(VarDouble As String, FieldOrig As TextBox, FieldDouble As TextBox)
Dim Result As Integer
Dim Result2 As Integer
If FieldOrig = FieldDouble Or (IsNull(FieldOrig) And IsNull(FieldDouble)) Then
Else
Result = MsgBox("DATA ENTRY ERROR!" & Chr(13) & Chr(13) & "The ORIGINAL value entered for this field was ( " & FieldOrig & " )" & Chr(13) & Chr(13) & "Your CURRENT entry is ( " & FieldDouble & " )" & Chr(13) & Chr(13) & "Is ( " & FieldDouble & " )" & " the correct entry for this field?", vbYesNo + vbDefaultButton2)
If Result = 6 Then
Result2 = MsgBox("CONFIRM CHANGE!" & Chr(13) & Chr(13) & "Are you sure ( " & FieldDouble & " )" & " is the correct value for this field?" & Chr(13) & "The ORIGINAL value will be changed to ( " & FieldDouble & " )", vbYesNo + vbDefaultButton2)
If Result2 = 6 Then
FieldOrig = FieldDouble
Else
MsgBox "Please enter the correct value for this field"
'SendKeys "{TAB}", False
'DoCmd.GoToControl VarDouble
FieldDouble.SetFocus
End If
Else
MsgBox "Please enter the correct value for this field"
'SendKeys "{TAB}", False
'DoCmd.GoToControl VarDouble
FieldDouble.SetFocus
End If
End If
End Function
I use the following function to compare a value(FieldDouble) in B Database to aother value(FieldOrig) in a linked table from A Database. If the FieldDouble is entered differently from FieldOrig, I want the focus stays in FieldDouble.
Neither FieldDouble.SetFocus nor DoCmd.GoToControl VarDouble works. The cursor still goes to the next field without error message. SendKeys "{TAB}", False takes the cursor to the second field after FieldDouble. Can somebody help me fix this problem?
Public Function Compare(VarDouble As String, FieldOrig As TextBox, FieldDouble As TextBox)
Dim Result As Integer
Dim Result2 As Integer
If FieldOrig = FieldDouble Or (IsNull(FieldOrig) And IsNull(FieldDouble)) Then
Else
Result = MsgBox("DATA ENTRY ERROR!" & Chr(13) & Chr(13) & "The ORIGINAL value entered for this field was ( " & FieldOrig & " )" & Chr(13) & Chr(13) & "Your CURRENT entry is ( " & FieldDouble & " )" & Chr(13) & Chr(13) & "Is ( " & FieldDouble & " )" & " the correct entry for this field?", vbYesNo + vbDefaultButton2)
If Result = 6 Then
Result2 = MsgBox("CONFIRM CHANGE!" & Chr(13) & Chr(13) & "Are you sure ( " & FieldDouble & " )" & " is the correct value for this field?" & Chr(13) & "The ORIGINAL value will be changed to ( " & FieldDouble & " )", vbYesNo + vbDefaultButton2)
If Result2 = 6 Then
FieldOrig = FieldDouble
Else
MsgBox "Please enter the correct value for this field"
'SendKeys "{TAB}", False
'DoCmd.GoToControl VarDouble
FieldDouble.SetFocus
End If
Else
MsgBox "Please enter the correct value for this field"
'SendKeys "{TAB}", False
'DoCmd.GoToControl VarDouble
FieldDouble.SetFocus
End If
End If
End Function