[Gambas-user] One report for each query?

Fabien Bodard gambas.fr at gmail.com
Sat Nov 2 12:50:55 CET 2019


well because you use only the auto generated instance .

When you call Report1.Preview

in background it do a thing like

Report1 = New Report1

So the object Report1 theoretically is not callable directly. In the past
... in the beginning of gambas ... (well 20 years) You cannot do Form1.Show

You'll have to do a :
Dim hForm as new Form1 as "Form"
hForm.Show

All of that to say .... in your case do :

Public Sub Button1_Click()
  hreport = new Report1
  $hResult = MBase.ReturnDataNumber()
  If Not $hResult Then
    Message.Error(("Query result not available\n\nSorry but it is
impossible to continue."))
    Me.Close
    Return
  Endif
hReport.Preview

End

Public Sub Button2_Click()
  hReport = new Report1
  $hResult = MBase.ReturnDataDate()
  If Not $hResult Then
    Message.Error(("Query result not available\n\nSorry but it is
impossible to continue."))
    Me.Close
    Return
  Endif
  hReport.Preview

End



Le ven. 1 nov. 2019 à 18:24, Gianluigi <bagonergi at gmail.com> a écrit :

> Hi Fabien,
>
> inspired by a discussion on the German forum I wanted to see if I could
> make a report in that way.
> I was unable to use the same report for two slightly different queries.
> Should I use a different report for each query?
> I can't change the color of the writing with the code.
>
> Any suggestions?
>
> Regards
> Gianluigi
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>


-- 
Fabien Bodard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20191102/18441dbc/attachment.html>


More information about the User mailing list