472,331 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 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
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.

Nov 13 '05 #1
1 2769
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.


Nov 13 '05 #2

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

Similar topics

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.),...
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...
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...
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...
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...
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...
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. ...
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...
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...
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...
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.