Subject Re: SQL Filter
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Tue, 27 Aug 2024 14:09:31 -0700
Newsgroups dbase.getting-started

On 8/27/2024 1:16 PM, Simon Catchpole wrote:
> Please could someone help. I am trying to filter on an entryfield and then display the result
> mchoice = form.container1.choicebox1.value
>                 
> q=new query()
> q.sql:=select * from "statements.dbf" where source = "%mchoice%"
> q.active:=true
> form.statementsdatamodule1.statements1.rowset.first()

Are you getting an error? Invalid results?

If you are doing a new query, the results are not going to be in the
query contained in the datamodule. You should be doing all of this with
the datamodule.

// reference the query in the datamodule:
q=form.statementsdatamodule1.statements1 // create a shortcut variable
q.sql:=select * from "statements.dbf" where source = "%mchoice%"
q.active:=true
q.rowset.first()

Hope that helps. The two different queries don't know about each other
(which can be useful sometimes, but your separate query won't affect the
one in the datamodule).

Ken

--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm