473,703 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
(CubiertaCalcul acion) which holds a calculation for form (c)(grandchild)
..............T he 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*Fi eld2) by the way this a sample calculation as the real one is
very complex and I cannot place it on the query(qryCubier ta) 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.OpenRecord set("qryCubiert a", DB_OPEN_DYNASET )

Do Until rst.EOF
Call CubiertaCalcula cion
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 2935
Hi gavo,

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

Other options:
- Create the recordset in CubiertaCalcula cion, 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
CubiertaCalcula cion(Field1,Fie ld2,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.), SHOWS (ShowID, ShowDescription) and SHOWDETAILS (links the previous tables together so not to have a many-to-many relationship -- has the ContactID and ShowID fields). I have a main form with a couple of listboxes which are used for querying the CONTACTS table. The results populate bound fields...
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 user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
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 underlying the subform." ....................hmmmmmmmmm................... I put in a field in the underlying table with a default value of 1. I created a text box which adds up the values in the new field
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. Tables: (abbreviated) TblDivision DivisionID
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 created a search button on my form and it does its job quite well. It presents the user with an inputbox, prompting for the string to search. Then the code returns with a record number of the record which contains the string. Here's the problem. I...
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 either an option button plus two text fields or a checkbox plus two text fields Am wanting to save the user entries into an underlying table. Tag property for each option button, check box or text field has the value of the key
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 run some code that affects the main form which forces focus *away* from the subform and puts it to the main form. I need to keep focus on the subform when the code in the
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 user...an IssueDate and a ReturnDate. I am trying to give the user the option of entering the date into the date field text box, or clicking a button next to the text box to open a seperate form with a calendar in it (frmCalendar).
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 with a list of selections. What I want is to have cretin entry fields on the continuous subform show up depending on the selection of the combo box. I can get this to work with the code below but it updates all the records of the 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 all companies on a continuous form with their employees on a sub form as another continuous form, as shown below
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.