I entered code into the Script Editor for a Command Button on a Data Access Page that will prompt the user to find a text string. I followed the code from this link:
http://msdn2.microsoft.com/en-us/library/a...office.10).aspxSection named: Add a Find Button to a Page
I typed in the code in the "On Click" event for the Cmmd Button in the Script Editor.
I am getting a 3265 error "Item cannot be found in the collection corresponding to the requested name or ordinal.
In my Access Database, I have a NAME field and an ABBREVIATION field. I would like the user to be able to type in the Name to find it instead of having to scroll through page after page of data.
Another problem is that I don't understand where to put the oEventInfo code that they claim unblocks MS Data Source Control events. When I put it in, my page gets errors.
<script LANGUAGE=vbscript FOR=MSODSC EVENT=Current(oEventInfo)>
I took college classes on VB and VBA around 6 years ago and haven't done this on the job since then, so I am very rusty with all this.
This is my code.
<script language=vbscript event=onclick for=cmmdFindName>
<!--
'Clone the recordset.
Dim rs
Set rs=MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "WORD= '" & CStr(InputBox("Please enter word to find", "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 succes.
If(rs.bof) or (rs.eof)Then
Msgbox "No Name found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
This post has been edited by 8cats: 16 Oct, 2007 - 07:36 AM