Solved

TDBGrid and Multiselect with Quickreport

Posted on 1997-03-13
5
404 Views
Last Modified: 2013-11-22
I have a TDBGrid with some data fields in it. Then I set the multiselect option to true in order to be able to choose several fields in the grid. And now, I want to tell QuickReport that he has to print a report I've previously created taking the data from the fields i have selected in the grid. How can I do that?
For Example: I have a grid with customers and I select 3 customers and I want my report (that prints the personal information of a customer) to print the information of only those 3 customers I have selected.
0
Comment
Question by:sime
[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
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:javiertb
ID: 1334749
You should copy those selected records to another table attached to a datasource so you can switch quickreport to connect this datasource to print them.
Hope this helps.
0
 

Author Comment

by:sime
ID: 1334750
But, how can I know which records I have selected in the grid ?
0
 
LVL 2

Accepted Solution

by:
javiertb earned 100 total points
ID: 1334751
You can browse the rows checking for selected ones with:

   if DBGrid.SelectedRows.CurrentRowSelected then
        // Some code here. i.e.:copy to your temp. table

0
 

Author Comment

by:sime
ID: 1334752
Hi, I have tried what you told me and it haven't resolved my problem yet. Please write me down what I have to write (source code) to copy one by one the records I have selected in the DBGrid, because with CurrentRowSelected I only get then Current Record and I want them all (I can't find any help about this feature). Thanks very much.
0
 
LVL 2

Expert Comment

by:javiertb
ID: 1334753
- Suppose you have 3 selected records.

 Table.Open;
 Table.First;
 while (not Table.EOF) do
 begin
    if DBGrid.SelectedRows.CurrentRowSelected then
      // copy to your temp table
      // i.e.: TableTemp.Append;
      //       TableTempField1.Value:=Table1Field1.Value;
      //       TableTemp.Post;  
    Table.Next;
 end

You can also use bookmarks to avoid losing previous database pointer.


0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 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