Adding a Find button (function) to a data access page

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

I created a database for my employees. I like the way the data access pages
look, but each employee have many records that they have to go through. Is
there a way to add a find button or find function to the design of the page
that will allow them to search their records without going through each entry
one by one?

Your help is much appreciated...
 
i create a form with a combo box that has all employees. then i create a
query that the criteria is set to that combo box. you can then embed the
query in that form. seems to work for me.

sam
 
Yes,

In Design View, add a Command Button. "Default name command0

Hit the "script" icon at the top which opens up the script editior

On the left pull dow just above the screed find command0

On right pull down just aboce the screen find Onclick

Then finish the code, which should end up reading like this. You will need
to change the word "Description" for the column heading your are searching.

<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 "Description Like '%" & 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 "Word Not Found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
 
You can create a combobox that will server as a filter. For this to work,
the Group Filter Control option for this combobox control must be set.
There are two way to do this: you can either right click then chose Group
Filter Control or open the Group Level properties window and set the
GroupFilterControl to the name of the combobox control. The
GroupFilterField must also be set to the proper field, if I remember
correctly.

In the DAP newsgroup, you will find some posts about this topic:
microsoft.public.access.dataaccess.pages .

Another way to do this would be to use a Server filter but this is more
complicated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top