Solved

Access 2010

Posted on 2016-11-14
3
28 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 119

Accepted Solution

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

Expert Comment

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

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

18 Experts available now in Live!

Get 1:1 Help Now