|
Home > Archive > General Discussion > September 2003 > Attention VB programmers
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Attention VB programmers
|
|
| gitgod78 2003-09-23, 6:51 pm |
| Hi!
Long story short. I have created a database in Access for which I have created a data access page to. I want the user to be able to search the database throught clicking on a find button. The name of the field to be searched is "Co_Name"(short for company name, so it's text). I also want the user to be able to just type in the first few letters and then they might get multiple results from which they can click a next record button. I sort of got started with the help of the help screen in access. Here is the script so far. It only excepts number values and not characters. If I type in a letter I get an error anyways... Here it is. I need you guys and gals' expertice.
"<SCRIPT language=vbscript event=onclick for=Find>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "Co_Name="& Cstr (InputBox("Please enter client name","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 Client Found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>"
Please help!!!
Point me to resources write the script needed, anything would help at this point. PS! I am not a programmer but have pretty decent computer knowledge.
Thanks!
gitgod78 | |
| jkhnwspec 2003-09-23, 8:14 pm |
| You might start by looking here  | |
| Helen of Troy 2003-09-23, 8:41 pm |
| "<SCRIPT language=vbscript event=onclick for=Find>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "Co_Name="& Cstr (InputBox("Please enter client name","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 Client Found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>"
On error resume next??
Must be placed at top line of code.
Dim rs ... As????
A RecordSet or something?
ASP or some XXXX like that???
Set rs = MSODSC.DataPages(0).Recordset.Clone
That line will never work!!
i.e. Dim as a Recordset and then hope to Hell you can get the clone.
*Exit Sub* Yes I did that!
*Exit Sub* So let's just do it again!! 
If (rs.bof) or (rs.eof) Then
MsgBox "No Client Found",,"Search Done"
Exit Sub
End If
should read:
If rs.eof Then
MsgBox "No Client Found",,"Search Done"
Exit Sub
End If
But which Sub? 
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
Zero? Does this array element truly have any meaning?
If I bookmark then surely I simply choose the appropriate menu option?
-->
I love the look of the arrow it means the whole script is completely commented out ... 
Don forget Option Explicit 2 |
|
|
|
|