G
gaugust
When a new record is entered on a form I am checking the form recordsetclone
to be sure no other record has the same Study number. If a record is found
with the study number I display a message box and ask the user to enter a new
study number, however when I set the focus back to the study number, which is
the first field on the form, it will not set the focus back on the study
number field. The focus is being set to the next field on the form. I tried
to set the focus to other fields on the form and the set focus works. Any
idea why the set focus will not work for the first field? Here is my code:
With Me.RecordsetClone
.MoveFirst
.FindFirst "[StudyN] = " & Forms!frmPatient.txtStudyn.Value
If .NoMatch Then
Else
MsgBox "Study Number already found, please enter new study
number", vbExclamation, "Duplicate Study Number"
Forms!frmPatient!txtStudyn.SetFocus
End If
End With
to be sure no other record has the same Study number. If a record is found
with the study number I display a message box and ask the user to enter a new
study number, however when I set the focus back to the study number, which is
the first field on the form, it will not set the focus back on the study
number field. The focus is being set to the next field on the form. I tried
to set the focus to other fields on the form and the set focus works. Any
idea why the set focus will not work for the first field? Here is my code:
With Me.RecordsetClone
.MoveFirst
.FindFirst "[StudyN] = " & Forms!frmPatient.txtStudyn.Value
If .NoMatch Then
Else
MsgBox "Study Number already found, please enter new study
number", vbExclamation, "Duplicate Study Number"
Forms!frmPatient!txtStudyn.SetFocus
End If
End With