Solved

Access 2010

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

11 Experts available now in Live!

Get 1:1 Help Now