Find Button

N

Nikki

I am trying to put a find button on a DAP but it is not working for me- My
Table is a list of people and their Phone numbers. I want to search the last
name field. The following code gives an error 3001 when i type in a last
name. Any help is greatly appreciated. If you don't help with DAP pages-Is
there a site that I can go to?
Thanks-

<SCRIPT language=vbscript event=onclick for=cmdfind>

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

rs.find "[LastName]LIKE'*"& cstr(inputbox("Enter a Last Name","Find"))&"*'"
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 "Name Not Found",,"Search done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark=rs.Bookmark
 

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

Top