Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » access 2k3 - data access page search function
Closed Thread
Old 01-10-2005, 10:18 AM   #1 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default access 2k3 - data access page search function

IÂ’m having problems trying to construct a database for my company. They need the database to enter information about certain insurance policies that our company has. We have a table setup and ready to go. I need to allow multiple users to add records to the database so I want to setup a Data Access Page to accomplish this. However, thereÂ’s a problem IÂ’m still stuck on.

In the Data Access Page, I need the ability to search and display a record designated by the primary key field (policy number). I found code to do this, however when I goto inject the code into my page, it screws up by either displaying a blank page or only displaying my header. I try to inject the code by adding a command button, right click the button, click Visual Script Editor, select the object in the drop down, select the onclick event, add my code. HereÂ’s the code from http://office.microsoft.com/en-us/as...345491033.aspx

<SCRIPT LANGUAGE=vbscript FOR=MSODSC EVENT=Current(oEventInfo)>

<SCRIPT language=vbscript event=onclick for=Command0>
<!--
' Clone the recordset.

Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next

' This line assumes that the value you are filtering on is an integer.
' If the search value is a string, use slightly different syntax.
' For example, "CustomerID = '" & CStr(InputBox("Please enter customer to find", "Find")) & "'"
' rs.find "ProductID=" & cLng(inputbox("Enter a ProductID","Find"))
rs.find "CustomerID = '" & CStr(InputBox("Please enter customer to find", "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
-->
office politics is offline  
Old 01-10-2005, 12:42 PM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

update: Now I can get the page to display properly and it prompts for the string as it should however whatever I put in I get the error: 3265 the item cannot be found in the collection corresponding to the requested name or ordinal.

i removed this line of code: <SCRIPT LANGUAGE=vbscript FOR=MSODSC EVENT=Current(oEventInfo)>
office politics is offline  
Old 01-11-2005, 02:12 PM   #3 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

turned out to be that i had to change CustomerID to the feild i wanted the page to search from. This issue has been resolved.
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On