473,387 Members | 1,516 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,387 software developers and data experts.

How to get average values from a flexgrid and dump them into another flexgrid?

Mas Juliza Alias
Hi,

I have two tables (MSFlexGrid1 & MSFlexGrid2). MSFlexGrid2 contains data of Date, Time, Water Level, Volume, and Area. Some of the Date are the same in which the data are taken at different times of the same date. What I need here is that the average of the Water level, Volume, and Area data of the same date to be filled in the other table, MSFlexGrid1. The table should contain data of Date and the average of Water level, Volume, and Area of the same date from MSFlexGrid2. I already get the unique value of the date to be filled in MSFlexGrid1, with help from a helpful friend in Bytes, but I do not manage to get the average of those values sharing the same date.

Attached is the program i have so far. There are two command buttons on the first form, Sort and Next. Click Sort button to sort the data according to the date, and Next button to go to the next form, Form2. After select the From Date and To Date, the selected data should appear in both grids, MSFlexGrid2 and MSFlexGrid1.

Thank you in advance.
May 11 '12 #1

✓ answered by Guido Geurs

I hope this is the code you are looking for.

4 1909
Guido Geurs
767 Expert 512MB
Sorry for this late response but I'm working on it.

I have seen that the data is sorted!
So, I think the code can be as follow:
- Go in the recset to the first date of "DateFrom", loop until the date changes.
- concatenate all the values for volume, ... with the same date and count the times there is data for the same date.
- when the date changes, add to the average grid the (concatenated values/count).
- Loop this until the date is > "DateTo".

Maybe I have a working code today.
May 15 '12 #2
Guido Geurs
767 Expert 512MB
I hope this is the code you are looking for.
May 15 '12 #3
Yes, it is. The code working so well. I've tried to solve this quite a while but turns out not like I want it to be. I'm in the process to understand your code. Did you use the Breakpoint and Watch as in your article each time you solve a problem? I'm just amazed how you can solve a problem in such a short time.
Thank YOU & Happy Teacher's Day (I think of you as my VB teacher) :)
May 16 '12 #4
Guido Geurs
767 Expert 512MB
I almost always use Breakpoint and watch.
If I want to know the structure or contents of an array, which property a value of a component is keeping, the evolution of variables in a ForNext,... (see attached GIFs)
Attached Images
File Type: jpg breakpoint_1.jpg (31.2 KB, 145 views)
File Type: jpg breakpoint_2.jpg (45.4 KB, 136 views)
File Type: jpg breakpoint_3.jpg (62.4 KB, 154 views)
May 16 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: IceOnFire | last post by:
I am working on a script to extract statistics (which is updated daily) from a website, and insert them into a MySQL database. I want to take this website:...
2
by: RootShell | last post by:
Hello First of all i know that PHP is a server side, and JavaScript is a Client side programming language, but i need to know if there is any way i can add the variable "countDownInterval" from...
0
by: Russ Schneider | last post by:
On Fri, 26 Dec 2003, Russ Schneider wrote: > I need to transfer a dump from a psql 7.3 database to a 7.2 database. > > Is there any way to do this? In case anyone wants to know (or find out...
1
by: colleen1980 | last post by:
There is a form where it ask the two dates and then run a query then report. Private Sub Command36_Click() DoCmd.OpenQuery "qryResultsReport" DoCmd.OpenReport "rpt_TopTen", acPreview, "", ""...
8
by: pradeepss | last post by:
Guys, I have a text file which is comma delimited and information. Each information is ended by end of line and started again with comma delimited i.e. 1,2,3,a,4 2,s,4,5,6,7,8,h...
2
by: melisimp | last post by:
I am trying to select the following averages from the tables below. average order turn time in minutes (completion_time - order_time), average fee of the final invoice, and the average # of invoices...
3
by: Frank Rizzo | last post by:
I am trying to do some monitoring of some PerfMon counters and have a question. Does PerfMon figure out the Minimum, Maximum, Average values for each counter? Or are those values part of the...
1
by: renestigter | last post by:
hi all, I am not an SQL expert but have experience with DB2 on the Iseries/AS400. I simply want to generate an SQL database in OS400 DB2. My idea was to create a dump of the MySQL database so I...
0
by: renestigter | last post by:
hi all, I am not an SQL expert but have experience with DB2 on the Iseries/AS400. I simply want to generate an SQL database in OS400 DB2. My idea was to create a dump of the MySQL database I...
2
by: dispatch4599 | last post by:
I'm only a beginner in C++ and can not figure out how to read only 2 lines of my infile. The lines consist of all integers. Objective is to add all the integers in just those two lines and average...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.