473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Continuous subform -LOOP

Hello everyone! Using A2K

i have a form(a) with a subform(b) and within the subform there is a
continuous subform(c).

in the subform (b) there is a command button used to call a public function
(CubiertaCalculacion) which holds a calculation for form (c)(grandchild)
..............The calculation stores the result on a field (Total) on the
continuous subform(c) (grandchild) based on another two fields on the same
subform .............e.g. field1 (Quantity) Field2(Price)
Total(Field1*Field2) by the way this a sample calculation as the real one is
very complex and I cannot place it on the query(qryCubierta) the record
source of the continuous subform(c).

The calculation on the public function works fine, my problem is that when I
run the code from the subform(b) it only affect the first record showing on
subform(c) and I want the code to calculate the TOTAL for every record
showing on the continuous subform(c).

This ist the code behind the command button;

Private Sub Command48_Click()
Dim mydb As DAO.Database
Dim rst As DAO.Recordset
Set mydb = CurrentDb()
Set rst = mydb.OpenRecordset("qryCubierta", DB_OPEN_DYNASET)

Do Until rst.EOF
Call CubiertaCalculacion
rst.MoveNext
DoEvents
Loop
End Sub

I have placed the command button on the detail section of the continuous
subform(c) and it works fine, by it would implicate the user pressing the
button for every record showing to get a result, and I would prefer it as
explained above.

If any of you know what is wrong with my code, I would appreciate your
suggestion or working example.

Thanks
Nov 13 '05 #1
1 2883
Hi gavo,

It's pretty hard to tell what's going on without seeing
CubiertaCalculacion, but it appears that your recordset is not being
used properly. You call CubiertaCalculacion in exactly the same way for
every record in the recordset. You may need to pass some information
from rst to CubiertaCalculacion so it can process a different record
each time.

Other options:
- Create the recordset in CubiertaCalculacion, and loop to do the
calculations on each record.
- Build a function that does the calculation for one record, and call
it from a query. For example, use a query qryC for the RecordSource of
subform (c), and include something like
CubiertaCalculacion(Field1,Field2,Field3) as one of the fields.

Jerry

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Simon P | last post by:
Hello group, I'm in desperate need of help. Here goes : I have the following tables : CONTACTS (ContactID, FirstName, LastName, Company, etc.), SHOWS (ShowID, ShowDescription) and SHOWDETAILS...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
0
by: Karl Roes | last post by:
I'm still having trouble posting follow-ups. :-( "Unable to retrieve message 7cc66112.0501041919.3a6628b4@posting.google.com" Now Turtle wrote "You'll need an extra field in the table...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
3
by: Typehigh | last post by:
I am a good programmer, but this one stumps me! I have a form with a continuous subform. The continuous subform contains records of data and may reach a depth of 1000's of entities. I have...
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
1
by: kaeldowdy | last post by:
This one is stumping me! I have a Form/Subform arrangement. The main form is set as a Single Form and the sub form is set as Continuous Forms. On the Form_AfterUpdate event of the subform, I...
5
by: MOC835 | last post by:
I have calendar control that I am trying to use on a continuous subform to select two dates. My MainForm collects user data, and the continuous SubForm collects two dates for that specific...
1
by: Chipperzs | last post by:
All, First time user, I tried searching for related posts but none pertaining to my specific problem. I have a form with a "Continuous" subform on it. The Continuous subform has a combo box...
8
by: Steffen Beck | last post by:
Hi NG I need some help with a problem on my forms. If I have 2 related tables, for instance companies and employees, and want to display all companies on a continuous form with their...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.