Solved

Access 2010

Posted on 2016-11-14
3
31 Views
Last Modified: 2016-11-14
Hi Everybody!

The following code i have to loop thru the table in a form to add up all the size Qty's (20 sizes).
Is there a way to do same in a recordset to loop thru the same way? (e.i ctl.name and ctl)
If yes can you give me an example.
Thanks

 For Each ctl In frm.Controls
        If Left(ctl.Name, 2) = "SH" Then wQty = wQty + Nz(ctl)
    Next ctl
0
Comment
Question by:frimy
  • 2
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 41886462
you can open the table as recordset, i.e.,

dim rs as dao.recordset, j as integer
set rs=currentdb.openrecordset("TableX")

rs.edit
for j=0 to rs.fields.count-1
       rs(rs(j).name)= wQty + nz(rs(j).value)

next
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41886571
to go to a certain record, use a query with criteria

dim rs as dao.recordset, j as integer
 set rs=currentdb.openrecordset("select * from TableX where <criteria here>")

 rs.edit
 for j=0 to rs.fields.count-1
        rs(rs(j).name)= wQty + nz(rs(j).value)

 next
0
 

Author Closing Comment

by:frimy
ID: 41886779
Thank you very much
it works very good
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

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…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

776 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