Subject Re: Passing parameters from form to report
From Bob grimes <Bandgtshirts@aol.com>
Date Tue, 09 Feb 2016 05:58:22 -0500
Newsgroups dbase.getting-started

Mervyn Bick Wrote:

> On 02/09/2016 09:50 AM, Mervyn Bick wrote:
>
> >> My problem is that I cannot however get it to work with more than one
> >> memory variable in one SQL statement. For instance when I want to
> >> filter an account statement from the bought ledger for one supplier
> >> and with a start date and an end date.
> >> I can filter a table by typing the following in the command window
> >
> > It's messy and I don't recommend  this method of passing parameters into
> > a report but something like the following should work.
> >
> > sql = "select * from feedtails where feedtailsid = " + feedtailsidx +  "
> > and supplier_id = " + supplieridx
> >
> > If the supplier_id is character then you would need to wrap the
> > parameter in quotes.
> >
> >
> > sql = "select * from feedtails where feedtailsid = " + feedtailsidx +  "
> > and supplier_id = '" + supplieridx + "'"
>
>
> Some more on this.
>
> If you want to pass dates in using this method the dates must be
> strings, not dates.
>
> Literal dates in localSQL must either be in the form mm/dd/yyyy
> (American) or dd.mm.yyyy (German) irrespective of what the computer's
> date format is set to.  localSQL may not be so fussy (I can't check at
> the moment) but "proper" SQL requires literal dates be wrapped in single
> quotes.
>
> startdate = "01/01/2016"  //text, not date format.
> enddate = "01/31/2016"
>
> sql = "select * from feedtails where feedtailsid = "+feedtailsidx+" and
> idate between '"+startdate+"' and '"+enddate+"'"
>
>
> Note that if you pass dates in using parameters in a query then the
> dates must be in date format.
>
> Mervyn.
>
>
> thanks very much for the above Mervyn

You really have helped me to understand the way that parameters can be passed from a form to a report that is loaded into memory by the form.
As I understand it  the parameters to be used are setup in the original form query and values are assigned to them there.
These parameter values can then be changed by an event on the form , on_click ,on_change etc.
The code in the event handler then changes some or all of the parameters and the query is requeryied.
The report is then rendered.
I presume that I can use memory variables instead of object values where necessary.
It does seem a good way to do the job.
Unfortunately I can't try it today as my laptop has gone down with a bug with cpu usage constantly 99% and memory usage constantly 80% hopefully it's not fatal

Thanks for your help

Bob

Ps thanks for the extra info re dates



>