?
Solved

DBGrid Question: How can I implement this?- i think it´s noob question

Posted on 2004-08-31
4
Medium Priority
?
141 Views
Last Modified: 2010-04-05
Hi folks,

I have one table (table_1) which contains 4 fieds:
1) ID;
3) Product_Name;
2) Date;
4) Price.

I set a DBGrid to shows all my RECORDS related to some month (for example, August), ordering by date. So, it seems like:

==============================
ID----Product_Name---Date-----------Price
01---Product1----------01/08/2004---20.00
02---Product2----------01/08/2004---10.00
03---Product3----------01/08/2004---50.00
04---Product4----------02/08/2004---30.00
05---Product5----------02/08/2004---10.00
06---Product6----------05/08/2004---20.00
07---Product7----------07/08/2004---15.00
(...)
==============================

I need to put in another table(table_2 - 2 fields: Date and Amount)the amount of product´s price for DATE and shows it in another DBGrid. So, this second DBGrid will be something like:

==============================
Date------------Amount
01/08/2004----80.00
02/08/2004----40.00
05/08/2004----20.00
07/08/2004----15.00
(...)
==============================


How can i implement this? I am using ADO components to connect into my MS Access database.

Best regards.
0
Comment
Question by:joelsilva
[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
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 120 total points
ID: 11948973
use a tadoquery as dataset with a select like

select Date, sum(price) from yourtablename group by date

btw. what means noob?

meikl ;-)
0
 

Author Comment

by:joelsilva
ID: 11949147
Hi Kretzchmar... How´ve you been friend?

"Noob" means something related to NOVICEs.

Ok... You got it again. Now my first DBGrid seems like:

==============================
Date------------Price
01/08/2004----80.00
02/08/2004----40.00
05/08/2004----20.00
07/08/2004----15.00
(...)
==============================

So, the first QUESTION is done.

The second question in this TOPIC is:

How could i INSERT in a new TABLE the new information that is in my DBGrid (as i mentioned) now and shows it in another DBGrid?

Did you get it? In the first DBGrid i just see the RESULTs from a SELECT instruction. I´d like that these results be POST in another TABLE (table_2) and i´d like to see them in another DBGrid.

Thank you for now, friend.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11949274
also this can be done easily

use again a adoquery with a statement  like

insert into yourtable2name (Date,amount) select Date, sum(price) from yourtable1name group by date

use the execsql method for this statement

hope i understand this q correct

meikl ;-)

0
 

Author Comment

by:joelsilva
ID: 11949297
You got it man!!! You are a STAR!!!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 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