Solved

Access 2010

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
default value of combobox 25 70
print previewing the record showing on the form 4 51
Why Won't My Excel Workbook Refresh The Data 2 47
office 2016 license quastion 3 45
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

751 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