M
mhusainy
Hello,
I am trying to put a search button in a data access page where it will
search whether the user input exists in the database or not( whether
its a valid record or not ) and its the first field of the recordset
(string). I used the following for the button's onclick event
-------------------
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
' This line assumes that the value you are filtering on is an integer.
' If the search value is a string, use slightly different syntax.
' For example, "CustomerID = '" & CStr(InputBox("Please enter
customer to find", "Find")) & "'"
rs.find "License Plate = '" & CStr(inputbox("Enter a License
Plate","Find")) & "'"
' Custom error handling.
If (err.number <> 0) Then
Msgbox "Error: " & err.number & " " & err.description,,"Invalid
Search"
Exit Sub
End If
' Check search results for success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Product found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
---------------------------
when i clicked the button it prompted me the window for the search but
when i type in any information or even if i dont type in and hit enter
its giving me the error message 3001
Error 3001 Arguments are of the wrong type, are out of accetable
range, or are in conflict with one another.
I am a very new Access user.
Please help.
Thanks
I am trying to put a search button in a data access page where it will
search whether the user input exists in the database or not( whether
its a valid record or not ) and its the first field of the recordset
(string). I used the following for the button's onclick event
-------------------
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
' This line assumes that the value you are filtering on is an integer.
' If the search value is a string, use slightly different syntax.
' For example, "CustomerID = '" & CStr(InputBox("Please enter
customer to find", "Find")) & "'"
rs.find "License Plate = '" & CStr(inputbox("Enter a License
Plate","Find")) & "'"
' Custom error handling.
If (err.number <> 0) Then
Msgbox "Error: " & err.number & " " & err.description,,"Invalid
Search"
Exit Sub
End If
' Check search results for success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Product found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
---------------------------
when i clicked the button it prompted me the window for the search but
when i type in any information or even if i dont type in and hit enter
its giving me the error message 3001
Error 3001 Arguments are of the wrong type, are out of accetable
range, or are in conflict with one another.
I am a very new Access user.
Please help.
Thanks