Solved

Use VBA to Update All on Filtered Form

Posted on 2011-02-27
4
249 Views
Last Modified: 2012-05-11
Hi,

Take a simple table with 5,000 records;
Product
Supplier
Area
Price

I have a continuous form which display these 4 fields.
I will use the standard "filter" facilities to restrict which records are displayed.

My Requirement: When I click on a button how do I set the [Price] field to zero for the records that are filtered.

I guess, the key thing here is how do I process my update on ONLY the filtered records.

0
Comment
Question by:Patrick O'Dea
  • 3
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34991972

with me.recordset
     .edit
     !price=0
     .update
end with
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 34991980
oops

with me.recordset
.movefirst
    do until .eof
     .edit
     !price=0
     .update
     .movenext
   loop
end with
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34992002
you have to run the codes after applying your filter..
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 34992027
Thanks, Perfect!

An elegant solution.
I have never used recordsets before.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question