1 (edited by thezimguy 2019-09-05 19:08:33)

Topic: Possible Error

Hello Dmitry, Derek and MVD lovers, please take a look at the attached and help me figure this out.
When I click on "REPORT SQL" button, a "SAVE RECORD" Button is forcly submitted.
But when the frmPayment form becomes the main form the error does not show.
Help
Thank you
https://i.postimg.cc/90WKjMmV/fee-Man-Error.png

Post's attachments

Attachment icon feeManError.zip 243.36 kb, 282 downloads since 2019-09-05 

@thezimguy

Re: Possible Error

Hi,
Can you attach your project with the 'report sql' button placed on the form so the error can be reproduced?
Derek.

3 (edited by thezimguy 2019-09-05 19:09:17)

Re: Possible Error

Hi Derek, please the project is already attached.
I have also attached an image.

@thezimguy

Re: Possible Error

Please see this attachment
Please select details as follow
https://i.postimg.cc/Y9Vbqzwp/fee-Man-Error1.png

Make sure to select the bill in stage 2
Do not make payment
Select a statement to print in stage 4
Click on the print button.
You will realize that a new record will be added to the "STATEMENT OF COLLECTION"
Help please
https://i.postimg.cc/tJxD1nXF/fee-Man-Error2.png

Post's attachments

Attachment icon feeManError2.zip 241.61 kb, 328 downloads since 2019-09-05 

@thezimguy

Re: Possible Error

Report button automatically presses button with action "Save Record" to save data from form to database, because button with action "Report" gets data from database, not from form.


In your case, you can use variables to use it in report, example:

procedure Form1_Button4_OnClick (Sender: TObject; var Cancel: boolean);
begin
    Form1.frxReport.Clear;

    // DESIGN MODE
        Form1.frxReport.LoadFromFile(ExtractFilePath(Application.ExeName)+'Report\1.fr3');
        Form1.frxReport.Variables.Clear;
        Form1.frxReport.Variables[' ' + 'My Category 1'] := Null;
        Form1.frxReport.Variables['My Variable 1'] := 10;
        Form1.frxReport.Variables['My Variable 2'] := ''''+'Hello'+'''';
        Form1.frxReport.DesignReport;


    // PREVIEW MODE
      //Form1.frxReport.LoadFromFile(ExtractFilePath(Application.ExeName)+'Report\1.fr3');
      //Form1.frxReport.Variables.Clear;
      //Form1.frxReport.Variables[' ' + 'My Category 1'] := Null;
      //Form1.frxReport.Variables['My Variable 1'] := 10;
      //Form1.frxReport.Variables['My Variable 2'] := ''''+'Hello'+'''';
      //Form1.frxReport.ShowReport;
end;
Dmitry.

Re: Possible Error

please upload the corrected project, if you do not mind...

JUST LEARNING, O GOD HELP ME.

Re: Possible Error

DriveSoft wrote:

Report button automatically presses button with action "Save Record" to save data from form to database, because button with action "Report" gets data from database, not from form.


In your case, you can use variables to use it in report, example:

procedure Form1_Button4_OnClick (Sender: TObject; var Cancel: boolean);
begin
    Form1.frxReport.Clear;

    // DESIGN MODE
        Form1.frxReport.LoadFromFile(ExtractFilePath(Application.ExeName)+'Report\1.fr3');
        Form1.frxReport.Variables.Clear;
        Form1.frxReport.Variables[' ' + 'My Category 1'] := Null;
        Form1.frxReport.Variables['My Variable 1'] := 10;
        Form1.frxReport.Variables['My Variable 2'] := ''''+'Hello'+'''';
        Form1.frxReport.DesignReport;


    // PREVIEW MODE
      //Form1.frxReport.LoadFromFile(ExtractFilePath(Application.ExeName)+'Report\1.fr3');
      //Form1.frxReport.Variables.Clear;
      //Form1.frxReport.Variables[' ' + 'My Category 1'] := Null;
      //Form1.frxReport.Variables['My Variable 1'] := 10;
      //Form1.frxReport.Variables['My Variable 2'] := ''''+'Hello'+'''';
      //Form1.frxReport.ShowReport;
end;

Thank you very much Dmitry. I will try it out
Really appreciated

@thezimguy