Welcome to Dream.In.Code
Become an Expert!

Join 149,582 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,772 people online right now. Registration is fast and FREE... Join Now!




Access Data Page VBScript

 
Reply to this topicStart new topic

Access Data Page VBScript, Code for Find Command Error 3265

8cats
16 Oct, 2007 - 06:00 AM
Post #1

New D.I.C Head
*

Joined: 30 Dec, 2004
Posts: 32

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).aspx

Section 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
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 10:47PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month