Hello
i have a problem with my search feature, i have searched these forums and found a similar problem but i tried that solution and it didnt work
run-time error '3265':
item cannot be found in the collection corresponding to the requested name or ordinal
it highlights
DataEnvironment1.rsPersonal.Filter = "P_LastName Like '" & SearchValue & "*'"
when i debug
i have removed that line of code and it runs though and gives me all results in database
any help would be much appreciated
thank you
here is the fullcode
Private Sub cmdSearch_Click()
Dim SearchValue As String
'Seach database using input box
SearchValue = InputBox("Enter Contact Surname")
'If no search criterea entered - cancel search
If SearchValue = "" Then
MsgBox "You must enter a name, please try again"
SearchValue = InputBox("Enter Contact Surname")
lblRecord.Caption = ""
MsgBox "Search Canceled"
Else
'Otherwise match last name to user input
DataEnvironment1.rsPersonal.Filter = "P_LastName Like '" & SearchValue & "*'"
'Show number of records matching search critera
lblRecord.Caption = "Number of matching records : " & DataEnvironment1.rsPersonal.RecordCount
'If no matching records display message
If DataEnvironment1.rsPersonal.RecordCount = 0 Then
MsgBox "No Matching Records - Returning to first Record"
'Return form to original state
DataEnvironment1.rsPersonal.Filter = ""
DataEnvironment1.rsPersonal.MoveFirst
lblRecord.Caption = ""
End If
End If
End Sub
i have a problem with my search feature, i have searched these forums and found a similar problem but i tried that solution and it didnt work
run-time error '3265':
item cannot be found in the collection corresponding to the requested name or ordinal
it highlights
DataEnvironment1.rsPersonal.Filter = "P_LastName Like '" & SearchValue & "*'"
when i debug
i have removed that line of code and it runs though and gives me all results in database
any help would be much appreciated
thank you
here is the fullcode
Private Sub cmdSearch_Click()
Dim SearchValue As String
'Seach database using input box
SearchValue = InputBox("Enter Contact Surname")
'If no search criterea entered - cancel search
If SearchValue = "" Then
MsgBox "You must enter a name, please try again"
SearchValue = InputBox("Enter Contact Surname")
lblRecord.Caption = ""
MsgBox "Search Canceled"
Else
'Otherwise match last name to user input
DataEnvironment1.rsPersonal.Filter = "P_LastName Like '" & SearchValue & "*'"
'Show number of records matching search critera
lblRecord.Caption = "Number of matching records : " & DataEnvironment1.rsPersonal.RecordCount
'If no matching records display message
If DataEnvironment1.rsPersonal.RecordCount = 0 Then
MsgBox "No Matching Records - Returning to first Record"
'Return form to original state
DataEnvironment1.rsPersonal.Filter = ""
DataEnvironment1.rsPersonal.MoveFirst
lblRecord.Caption = ""
End If
End If
End Sub