Subject Re: Passing parameters from form to report
From Mervyn Bick <invalid@invalid.invalid>
Date Tue, 9 Feb 2016 10:31:38 +0200
Newsgroups dbase.getting-started

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.