Private Sub Command1_Click()
'to search for a record
Dim PatientID, i As Integer
PatientID = InputBox("Enter the PatientIDNumber of the person you want to
search for!")
Me.AdoPatients.Recordset.MoveFirst
While (PatientID <> txtPatientID.Text And i <> 1)
Me.AdoPatients.Recordset.MoveNext
If Me.AdoPatients.Recordset.EOF = True Then i = 1
Wend
If Me.AdoPatients.Recordset.EOF = True Then
MsgBox ("Record not found!"), vbInformation + vbOKOnly
Me.AdoPatients.Recordset.MoveLast
Unload Me
frmPatients.Show vbModal
End If