1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Private Sub Search_Click()
On Error GoTo GestionErreur
Dim saisieAge As String
inputAge = InputBox("Enter age", "Find Age")
If Len(Trim(inputAge)) > 0 Then
Dim ageCriteria As String
ageCriteria = val(Trim(inputAge))
Adodc1.Recordset.Find "age = '" & ageCriteria & "'", 1, adSearchForward
If Adodc1.Recordset.EOF = True Then
MsgBox "No record Found", vbInformation + vbOKOnly, "No Match"
Else
Adodc1.Recordset.MoveFirst
z = z & Adodc1.Recordset!Name & " " & Adodc1.Recordset!surname
Do While Not Adodc1.Recordset.EOF
Adodc1.Recordset.MoveNext
Loop
End If
Exit Sub
GestionErreur:
MsgBox "Error while searching: " & Err.Description
End If
End Sub |
Partager