UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Help using Data Access Page - Searching    
 
   
patricknew
post Apr 7 2004, 08:56 AM
Post #1

New Member
Posts: 3



I am trying to create a data access page for my database to put on my company's intranet. I want to be able to search the recordset for a generic drug name. I have found some information about adding a search to a page in Access on Microsoft's webpage. I believe that the search is working, but at the end of the search, the database will not go to the record that was "found", but stays on the first record in the database. The following is the code that I am using now. Any help you could give me would be greatly appreciated. (I would also like to search using wildcards before and after the inputted text). Thanks for your help.

<SCRIPT language=vbscript event=onclick for=Command0>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next

rs.find "Genericname = '" & CStr(InputBox("Please enter a generic name to find", "Find")) & "'"

If (err.number <> 0) Then
Msgbox "Error: " & err.number & " " & err.Description,,"Invalid Search"
Exit sub
End if

If (rs.bof) or (rs.eof) Then
Msgbox "No Drug Found",,"Search Done"
Exit sub
End if

MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
Go to the top of the page
 
+
MJWilcek
post Apr 7 2004, 10:14 AM
Post #2

New Member
Posts: 14



Did you add the parameter to the event name:

<SCRIPT LANGUAGE=vbscript FOR=MSODSC EVENT=Current(oEventInfo)>
Go to the top of the page
 
+
patricknew
post Apr 7 2004, 11:08 AM
Post #3

New Member
Posts: 3



Thanks for your suggestion, but isn't that the same as the <SCRIPT language=vbscript event=onclick for=Command0> line? If not, then where do I put the <SCRIPT language=vbscript FOR=MSODSC event=Current(oEventInfo)? And are any of those commands supposed to be changed to fit the specifics for my page? As you can probably tell, I really have no clue what I am doing... Any help would be greatly appreciated.
Go to the top of the page
 
+
MJWilcek
post Apr 7 2004, 11:46 AM
Post #4

New Member
Posts: 14



Somehow, my last post got truncated, I originally had the following information:

I have been working on the same type of project you are. Actually, we both looked up the same help text, but I was wondering if you had seen the "Note" at the bottom of the text.

"NOTE When you create Visual Basic Scripting Edition (VBScript) blocks for MSODSC events, you must add a prameter to the event name, as follows:"

<SCRIPT LANGUAGE....

"The oEventInfo parameter is used to return specific information about the event to the script. You must add this parameter, whether or not it will be used, because the script won't work without it."

To be honest with you, I don't know where to put it. My uneducated guess is to put it after your last End If.
Go to the top of the page
 
+
patricknew
post Apr 7 2004, 11:52 AM
Post #5

New Member
Posts: 3



I did notice that and have attempted to add it to several different places in my search code. It hasn't worked so far. I'll let you know if I find something else. Thanks for your help.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 01:30 PM