Solved

Use VBA to Update All on Filtered Form

Posted on 2011-02-27
4
227 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 119

Expert Comment

by:Rey Obrero
ID: 34991972

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

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34991980
oops

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

Expert Comment

by:Rey Obrero
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now