RobertIngles
Technical User
If the user enters an invalid UserID then the error msg pops and the field resets - Works perfectly.
If the UserID is not matched then the inputer may continue creating a new record and I want the cursor to move to the next field.
What is wrong with my SetFocus statement?
Private Sub LaptopUserID_BeforeUpdate(Cancel As Integer)
'Create var.
Dim intChk As Integer
'This line counts the number of rec instances in TBLUser.
intChk = DCount("*", "TBLUser", "[UserID] = '" & Forms!FRMCreateNewLaptopandUserV3!LaptopUserID & "'")
'Does the rec exist? If not then Move to field Barcode and continue entry.
If intChk = 0 Then
Me.Barcode.SetFocus
Else
MsgBox "This UserID Already Exists", vbCritical
Cancel = True
Me.Undo
End If
End Sub
Thanks
Robert
If the UserID is not matched then the inputer may continue creating a new record and I want the cursor to move to the next field.
What is wrong with my SetFocus statement?
Private Sub LaptopUserID_BeforeUpdate(Cancel As Integer)
'Create var.
Dim intChk As Integer
'This line counts the number of rec instances in TBLUser.
intChk = DCount("*", "TBLUser", "[UserID] = '" & Forms!FRMCreateNewLaptopandUserV3!LaptopUserID & "'")
'Does the rec exist? If not then Move to field Barcode and continue entry.
If intChk = 0 Then
Me.Barcode.SetFocus
Else
MsgBox "This UserID Already Exists", vbCritical
Cancel = True
Me.Undo
End If
End Sub
Thanks
Robert