FunkFly555
Technical User
Hi,
I would be very appreciative if you can help me with the following.
Using: Access 2003
Object: Pages (data access page)
Problem:
I've build a data access page and would like to add a search button on the page that would allow a user to enter a Company name that would then bring up the corresponding companies details after clicking find.
How I went about it:
I've deactivated the 'Control Wizard', clicked on the 'Command Button' tool and then clicked in the Header section of my Page under design to place the button. I then went into the 'Microsoft Scrip Editor', selected my object in the dropdown 'command0' then select 'onclick' in the event dropdown where I add the following code.
<SCRIPT language=vbscript event=onclick for=command0>
<!--
' Clone the recordset.
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
-->
rs.find "Company Name = '" & cStr(inputbox("Enter a Key Word","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 success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Product found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
I then saved my work and tested the button in the web page preview only to get the following error after clicking on the Find button after entering the company name I would like to search.
Error: 3001 Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another
Please can you advice me / give me an alternative in achieving a way of searching/ selecting records from a Data access page.
I would be very appreciative if you can help me with the following.
Using: Access 2003
Object: Pages (data access page)
Problem:
I've build a data access page and would like to add a search button on the page that would allow a user to enter a Company name that would then bring up the corresponding companies details after clicking find.
How I went about it:
I've deactivated the 'Control Wizard', clicked on the 'Command Button' tool and then clicked in the Header section of my Page under design to place the button. I then went into the 'Microsoft Scrip Editor', selected my object in the dropdown 'command0' then select 'onclick' in the event dropdown where I add the following code.
<SCRIPT language=vbscript event=onclick for=command0>
<!--
' Clone the recordset.
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
-->
rs.find "Company Name = '" & cStr(inputbox("Enter a Key Word","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 success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Product found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
I then saved my work and tested the button in the web page preview only to get the following error after clicking on the Find button after entering the company name I would like to search.
Error: 3001 Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another
Please can you advice me / give me an alternative in achieving a way of searching/ selecting records from a Data access page.