Z
zhou.viola
Hi, pal:
I created a data access page using MS Access, in which I built a
"search button" to find the record by entering one field, e.g. Name. I
have over 400 records in this database.
For the first 200 records, this search button works fine, and the
corresponding record shows up right after I press "enter" key in the
text field of "Name".
The problem is: when I am trying to search some records not in the
first 200 records, the corresponding record doesn't show up after I
press "enter" key in the text field of "Name", and it is still the
first record on screen. Only if I search some records in the first 200
first, and then it will work; Or press the navigation button first, and
then the search button will work for the other records which is not the
first 200 records.
I tried to entering something not in the record, and it will give the
message saying "matching records not found". So I guess the search
button works, but somehow the record just doesn'd show up.
Codes used is as following:
<SCRIPT language=vbscript event=onclick for=Go>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
Dim strNMSearch
strNMSearch = Trim(NMSearch.value)
if strNMSearch = "" then
Msgbox "Please enter Name."
elseif strNMSearch <> "" then
rs.find "Name like '*" & NMSearch.value & "*'", 0, 1, 1
end if
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 matching Record found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
Gosh...I tried to figure this out for the whole day...but still have no
idea.....
Help, please!
I created a data access page using MS Access, in which I built a
"search button" to find the record by entering one field, e.g. Name. I
have over 400 records in this database.
For the first 200 records, this search button works fine, and the
corresponding record shows up right after I press "enter" key in the
text field of "Name".
The problem is: when I am trying to search some records not in the
first 200 records, the corresponding record doesn't show up after I
press "enter" key in the text field of "Name", and it is still the
first record on screen. Only if I search some records in the first 200
first, and then it will work; Or press the navigation button first, and
then the search button will work for the other records which is not the
first 200 records.
I tried to entering something not in the record, and it will give the
message saying "matching records not found". So I guess the search
button works, but somehow the record just doesn'd show up.
Codes used is as following:
<SCRIPT language=vbscript event=onclick for=Go>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
Dim strNMSearch
strNMSearch = Trim(NMSearch.value)
if strNMSearch = "" then
Msgbox "Please enter Name."
elseif strNMSearch <> "" then
rs.find "Name like '*" & NMSearch.value & "*'", 0, 1, 1
end if
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 matching Record found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
Gosh...I tried to figure this out for the whole day...but still have no
idea.....
Help, please!