Webmaster Forum

Go Back   Webmaster Forum > Scripting/Programming & Debugging > ASP & VBScript Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-16-2007, 04:48 PM
8cats 8cats is offline
Junior Member
 
Join Date: Oct 2007
Location: New York
Posts: 6
8cats is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default Error 3265 VBscript editor Data Access Page

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:

Adding Custom Filtering and Search Functionality to a Page

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.

I have a NAME field and an ABBREVIATION field. I would like the user to be able to type in the Name and find it's abbreviation.

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 "NAME= '" & 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>
Reply With Quote

This ad is part of our Revenue Sharing program
  #2 (permalink)  
Old 10-16-2007, 05:36 PM
ALL's Avatar
ALL ALL is offline
Senior Member
 
Join Date: Oct 2006
Location: Sturgis, SD
Posts: 145
ALL is on a distinguished road
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

is this for a web page or an independent application?
Reply With Quote
  #3 (permalink)  
Old 10-16-2007, 06:13 PM
8cats 8cats is offline
Junior Member
 
Join Date: Oct 2007
Location: New York
Posts: 6
8cats is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

This is for a Data Access Page which will be on a company Website.
Reply With Quote
  #4 (permalink)  
Old 10-16-2007, 06:23 PM
ALL's Avatar
ALL ALL is offline
Senior Member
 
Join Date: Oct 2006
Location: Sturgis, SD
Posts: 145
ALL is on a distinguished road
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

ok, so let me see if i got this right...

you want to have a button on a web page and have vbscript handle the onclick?
Reply With Quote
  #5 (permalink)  
Old 10-16-2007, 06:46 PM
8cats 8cats is offline
Junior Member
 
Join Date: Oct 2007
Location: New York
Posts: 6
8cats is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

Yes. This is a Data Access Page so it is linking to data in an Access Database. There is no "Find" feature on the Data Page navigation. I want to only display 5 records at a time on the page because it looks nicer. Therefore, the IE Find will only search the 5 records showing and not the entire list of records. I am trying to make a command button that will search all the data so the users do not have to look page by page. The link on Microsoft shows how to do it, but I am getting the error after the Find window pops up and I type in the value I am looking for.
Reply With Quote
  #6 (permalink)  
Old 10-16-2007, 08:33 PM
ALL's Avatar
ALL ALL is offline
Senior Member
 
Join Date: Oct 2006
Location: Sturgis, SD
Posts: 145
ALL is on a distinguished road
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

well my suggestion is to not do it the way they are saying to do it. I would do it more like this:

HTML Code:
<html> <head> <script type="text/vbscript"> Sub mySub() 'here is where your code to do the serch/filter will go 'as a test i put this alert here, you may want to take it out alert("mySub() was called when you clicked") End Sub </script> </head> <body> <input type="button" value="Find" onclick="mySub()" /> </body> </html>
I am not sure why microsoft did it the way they did, but this is how i would do it.
Reply With Quote
  #7 (permalink)  
Old 10-16-2007, 08:52 PM
8cats 8cats is offline
Junior Member
 
Join Date: Oct 2007
Location: New York
Posts: 6
8cats is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

Thank you, will try the code tomorrow. Time to leave work now...
Reply With Quote
  #8 (permalink)  
Old 10-17-2007, 02:52 PM
8cats 8cats is offline
Junior Member
 
Join Date: Oct 2007
Location: New York
Posts: 6
8cats is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

I tried the code and it stopped at the same place it did before. I didn't have the error checking code in place, but I'm sure it probably will give me the same error. It gets to the test that it called the sub.

The script editor also took out quotation marks when I saved it.

Here is the code:



<HEAD>

‘The script editor takes the quotes out when I save.
<SCRIPT type=text/vbscript>
Sub mySub()


Dim rs
Set rs=MSODSC.DataPages(0).Recordset.Clone

On error resume next
rs.find "WORD= '" & CStr(InputBox("Please enter word to find", "FIND"))& "'"




'test
alert("mySub() was called when you clicked")


MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark

End Sub


</SCRIPT>
(/HEAD>

‘The script editor does not accept the quotes around button, find and my sub.

<BODY>
onclick=mySub() tabIndex=16 type=button value=Find></DIV></BODY></HTML>
Reply With Quote
  #9 (permalink)  
Old 10-17-2007, 04:10 PM
8cats 8cats is offline
Junior Member
 
Join Date: Oct 2007
Location: New York
Posts: 6
8cats is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

I started totally from scratch and used the Microsoft code. It works now. I think I was trying too many things and something was wrong somewhere that I couldn't find. I think it was also because I had the page grouped. I created a new page ungrouped. I started out that way and since it wasn't working, I thought the page had to be grouped.

Thanks for you help anyway.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VbScript to update/delete/ insert in Access peachtea ASP & VBScript Forum 4 06-14-2008 12:02 PM
Example of Inserting and Retrieving data from xml file hanusoft Web Developers & Development Software 0 10-01-2007 06:26 AM
VBScript Permission Access Denied general_iroh ASP & VBScript Forum 1 06-28-2007 04:16 AM


All times are GMT. The time now is 05:48 AM.


Creative Commons License
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30