Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Find/Search Script in Data Access Page

Status
Not open for further replies.

dragonmanUSMC

IS-IT--Management
Joined
Dec 10, 2004
Messages
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)

I orginally posted this problem in the MS Access Other Topics forum but I haven't rec'd a response yet.

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>
 
Try setting the DataEntry property of the Page to False. If it is set to True then only new records can be added, you will not be able to see old records.
 
The DataEntry property was already set to False. Any other suggestion?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top