I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

April Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi Single User Apps Topic   Print This     

Printing from DBGrid

Printing from DBGrid in Delphi Single User Apps topic (part of our Pascal and Delphi Coding group).

Quick Search: Printing   Printing DBGrid  
Mido
 (Inactive)
-- USA
Hi all,
I have two forms .... the first one I used ADOQuery to search the Table and put the result in the DBGrid at the same form, when I press the button I should see the result of searching in the second form in the QReport .
any Idea ???? Confused Roll Eyes Big Grin!

Thanx
 Posted 19 years ago (Thread Starter)
Comment Quote
About Mido -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #1710, 3 replies
Thread Started 4/10/2001 9:08:00 PM
View Counter=2014
Last Reply Posted 4/16/2001 5:15:00 AM)
Location=-- USA 
Joined=19 years ago   MB Posts=21  
Mido
 (Inactive)
-- USA
Dear Sir,

Thanx for your reply , but I didn't got what you said .. infact I didn't know how to do it and where should I write it, so could you please exaplaine more.
Thanx again

Regards
 Posted 19 years ago (Thread Starter)
Comment Quote
About Mido -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #1745 (Level 1.1)  Reply to 1710
Thread Started 4/15/2001 8:09:00 PM
View Counter=2
Location=-- USA 
Joined=19 years ago   MB Posts=21  
Scott Wehrly
Prestwood IT
 (Inactive)
Las Vegas, NV USA
Well, here's a simple question.


Is the QReport on the second form linked to a TDataSource that points to the ADOQuery on the first form? Perhaps that's the problem.


This ususally trips folks up the first time they try it. Be sure that the uses section of the QReport form includes the form with the ADOQuery on it.


In the DataSource's DataSet attribute, the ADOQuery may not show up in the drop-down list, but you can type in the reference as a member of the first form, like in this example:

Unit QForm;
...
MyQuery : TADOQuery;
...
Unit ReportForm;
...
RptSource : TDataSource;
...


RptSource.DataSet := QForm.MyQuery;
 Posted 19 years ago
Comment Quote
About Scott Wehrly -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #1714 (Level 1.2)  Reply to 1710
Reply Posted 4/11/2001 4:15:00 AM
Location=Las Vegas, NV USA 
Joined=18 years ago   MB Posts=442   KB Posts=19  
Most Recent Post
Scott Wehrly
Prestwood IT
 (Inactive)
Las Vegas, NV USA
O-o-o-k-a-a-a-y-y... Big Grin!

Well, I can't know what your unit names or component names are, so I have to just provide a generic example to demonstrate what I meant.

I see now in the code example I showed above that I didn't make it clear enough (and I got the RptSource wrong...). Let me break it down better. I can't do screen shots in this forum, so you'll have to do with lines of code.

__________________________________________________

Let's take the one form with the TADOQuery, and the DBGrid. I think it would look something like this:

Unit QForm;
type
TMyQForm = class(TForm)
MyQuery : TADOQuery;
MySource : TDataSource;
MyGrid : TDBGrid;
... (other components)


with attribute settings that probably look something like this:

MySource.DataSet = MyQuery
MyGrid.DataSource = MySource
MyQuery.Active = True


Okay? This is something like what you should already have on the first form.

__________________________________________________

Now, about the second form. Here's a guess at what should be there:

Unit ReportForm;
type
TRptForm = class(TForm)
MyReport : TQuickRep;


Okay...mea culpa. Here's where I screwed up.

The QuickReport has a DataSet attribute. Since the TADOQuery doesn't sit on this form, you have to qualify the name using the name of the unit it resides in. In the DataSet attribute of the TQuickRep (MyReport), you type:

QForm.MyQuery

In code, this would be typed as:

MyReport.DataSet := QForm.MyQuery

If the TADOQuery is Active, or you used the Fields Editor to populate the form with TField components for the TADOQuery, you should be able to select DataField components for all of the QuickReport's Database variables.

For instance, let's say that you have a TQRDBText component on the QuickReport labeled as "First Name". And let's say that the TADOQuery includes a FirstName field, assigned to a TStringField component named MyQueryFirstName.

In code, you would assign the QuickReport's Database field to the TADOQuery's corresponding field like this:

QRDBFirstName.Data:= QForm.MyQueryFirstName

__________________________________________________


I hope that this is enough.
 Posted 19 years ago
Comment Quote
About Scott Wehrly -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #1749 (Level 1.3)  Reply to 1710
Reply Posted 4/16/2001 5:15:00 AM
Location=Las Vegas, NV USA 
Joined=18 years ago   MB Posts=442   KB Posts=19  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P184A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #1710 Counter
2014
Since 4/2/2008

Follow PrestwoodBoards on: 


©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech