This is done in a DataAccessPage using the microsoft script editor with Access 2003.
Say I use this line to search a field for a matching string.
That works fine if you know exactly what string you are looking for, but say you only know the first few letters. I tried to use the following line to get find to match wildcards without success. It will work if put the entire matching string in the input box; so "james" will match a recordset james, but the string "jam*s" will not match. Do I have a syntax problem or am I using the wrong function all together?
This is the entire block of code for the cmdSearch button onclick event.
I've looked everywhere for this information but I can't find anything that deals with user inputted data to know if my syntax is right.
Thank you for any help you may have,
James
Say I use this line to search a field for a matching string.
Code:
rs.find "[Customer NAME] = '" & CStr(InputBox("Please enter customer to find", "Find")) & "'"
Code:
rs.find "[Customer NAME] LIKE '" & CStr(InputBox("Please enter customer to find", "Find")) & "'"
Code:
<SCRIPT language=vbscript event=onclick for=cmdCustomerSearch> <!-- ' Clone the recordset. Dim rs Set rs = MSODSC.DataPages(0).Recordset.Clone On error resume next 'rs.find "[CUSTOMER NAME]=" & cStr(InputBox("Please enter customer to find", "Find"))&"" rs.find "[Customer NAME] = '" & CStr(InputBox("Please enter customer to find", "Find")) & "'" ' 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 --> </SCRIPT>
Thank you for any help you may have,
James
Comment