dragonmanUSMC
IS-IT--Management
- Dec 10, 2004
- 31
Hello, I have a script that will allow the user to search our database from a data access page for a company. (search is by CompanyName)
Here is the problem: The script only works after you have created a new company entry in the database. If you try to run the FIND script without entering new company info nothing happens, but it works fine as soon after. If you exit the DAP and come back later you have to repeat the process of entering new company data
Here is the script any help in why this doesn't work as soon as you launch the DAP would be greatly appreciated:
<SCRIPT language=vbscript event=onclick for=Command0>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "CompanyName= '" & Cstr(InputBox("Please Enter A Company Name To Begin Searching The Customer Database", "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 "I'm Sorry But That Company Does Not Appear To Be In The Customer Database",,"Done Searching"
Exit Sub
End if
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
Here is the problem: The script only works after you have created a new company entry in the database. If you try to run the FIND script without entering new company info nothing happens, but it works fine as soon after. If you exit the DAP and come back later you have to repeat the process of entering new company data
Here is the script any help in why this doesn't work as soon as you launch the DAP would be greatly appreciated:
<SCRIPT language=vbscript event=onclick for=Command0>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "CompanyName= '" & Cstr(InputBox("Please Enter A Company Name To Begin Searching The Customer Database", "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 "I'm Sorry But That Company Does Not Appear To Be In The Customer Database",,"Done Searching"
Exit Sub
End if
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>