Board index » off-topic » Newbie question - Printing single record reports
|
Kendra
Delphi Developer |
Newbie question - Printing single record reports2004-04-21 11:17:18 AM off-topic15 Using delphi 7 with the bde and paradox 4.0 tables. I'm trying to figure out how to pass the current record to a report previewer. The table containing the information has a keyed field "Tag#". When the user views that tag# in a form, edits, browses memo fields, etc, how can I pass the value of the tag# field to quickreport in order to print only that tag number, and not all 15,000+ of them ? I've used the following code in order to allow the user to input a value for the tag# , but can't figure out how to do it without the user having to enter a value. procedure TfmRepairReportOptions.btnPrintRepairFormClick(Sender: TObject); var TagNo: String; procedure Handler(Message:String); begin ShowMessage(Message + ' Try Again.'); eTagNo.SetFocus; end; begin with dmRepairsReport.tbRepairs do begin SetKey; FieldByName('TAG#').AsString:=eTagNo.Text; GotoKey; TagNo:=eTagNo.Text; if (TagNo < '100') or (TagNo>FieldByName('TAG#').AsString then raise ERangeError.Create('Tag Number does not exist!') else begin try Windowstate:=wsMinimized; fmPrintRepairForm:=TfmPrintRepairForm.Create(Self); fmPrintRepairForm.QuickRep1.Preview; finally Windowstate:=wsNormal; fmRepairReportOptions.Close; fmPrintRepairForm.Free; end; end; end; end; Obviously I wouldn't have to use the If greater than, less than statement, because the tag number does exist, because the user is currently viewing it, but I'm not sure how to change the rest. Thanks in advance. |
