Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2010

Posted on 2016-11-14
3
Medium Priority
?
56 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

715 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