I have the following code to validate part of a form:
Private Sub Adjuster_Number_BeforeUpdate(Cancel As Integer)
Dim strPt As String
Dim strTi As String
strPt = "Value must be 4 characters long."
strTi = "Incorrect Entry"
If Not Len(Adjuster_Number) = 4 Then
MsgBox strPt, vbCritical, strTi
Me.[Adjuster Number].SetFocus
Cancel = True
Exit Sub
Else
'do nothing
End If
End Sub
I am getting a Run-Time error on this part "Me.[Adjuster Number].SetFocus". It is saying that "You must save the field before you execute to GoToControl Action, the GoToControl method or the SetFocus method."
Any ideas why I might be getting this. I have used it before and did not get any errors.
Thanks!
Private Sub Adjuster_Number_BeforeUpdate(Cancel As Integer)
Dim strPt As String
Dim strTi As String
strPt = "Value must be 4 characters long."
strTi = "Incorrect Entry"
If Not Len(Adjuster_Number) = 4 Then
MsgBox strPt, vbCritical, strTi
Me.[Adjuster Number].SetFocus
Cancel = True
Exit Sub
Else
'do nothing
End If
End Sub
I am getting a Run-Time error on this part "Me.[Adjuster Number].SetFocus". It is saying that "You must save the field before you execute to GoToControl Action, the GoToControl method or the SetFocus method."
Any ideas why I might be getting this. I have used it before and did not get any errors.
Thanks!