Form to search

N

Neil

I have just imported a list of addresses and design a form which is linked
and i can add and change the lists via the form. But i would like to be able
for so one who uses the database to be able to open it and use the form to
also search through the database to find a certain address and amend if
needed.

Many thanks
 
M

Mark A. Sam

Niel,

Put a button on the Form header and add this code into the Click event:

rst.MoveFirst
Do Until rst.EOF
rst.Edit
rst![mCheck] = 0
rst.Update
rst.MoveNext
Loop

rst.Close
Set rst = Nothing

If you want to alternate from check to unchecked change line,

rst![mCheck] = False

to

rst![mCheck] = Not rst![mCheck]

An alternative method is this:

With Me.RecordsetClone
.MoveFirst
Do Until .EOF
.Edit
![mCheck] = False
.Update
.MoveNext
Loop
End With

I posted the first procedure becuase this isn't looping through the records
for some reason on my machine with Access 2007.

God Bless,

Mark A. Sam
 
P

Pat Hartman

If it is a simple, one field search, add an unbound text field or combo to
the form's header. Add two buttons - Search and show all. In the search
button, add a filter to the form and turn it on. In the show all button,
remove the filter.
 
A

Allen Browne

If you just want to search by one field, see:
Find as you type - Filter forms with each keystroke
at:
http://allenbrowne.com/AppFindAsUType.html
You don't need to write any code to get that to work in your database: just
copy'n'paste.

Addresses are usually broken down into several fields (city, state, zip,
etc), so you may want to provide the ability to filter on several fields. If
so, try this one:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
You do have to adapt this one to work with your fields, so it's more effort
to set up, but more powerful.
 

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