• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Use VBA to Update All on Filtered Form

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
Patrick O'Dea
Asked:
Patrick O'Dea
  • 3
1 Solution
 
Rey Obrero (Capricorn1)Commented:

with me.recordset
     .edit
     !price=0
     .update
end with
0
 
Rey Obrero (Capricorn1)Commented:
oops

with me.recordset
.movefirst
    do until .eof
     .edit
     !price=0
     .update
     .movenext
   loop
end with
0
 
Rey Obrero (Capricorn1)Commented:
you have to run the codes after applying your filter..
0
 
Patrick O'DeaAuthor Commented:
Thanks, Perfect!

An elegant solution.
I have never used recordsets before.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now