Topic: How to filter table grid results

Hi there

I’m trying to get to grips with everything and hit an issue I don’t know how to resolve

Overview= I am making an app to store details of historical documents and all the details associated. I have, for example, 2 tables: one for birth certificates recording all the details and people; and one for marriage certificates.

I don’t want to separate all the people into a separate table as I will end up with lots of forms having to open another form to add “groom” and “bride” which I want all in the marriage table

So I now want to be able to search for records in both tables by surname (for example)

I can populate a table grid with a sql query like:

Select bride from marriages
Union select groom from marriages
Union select person from births

Etc etc

But I can’t figure out how to filter the results in tablegrid using an edit box and a button. I keep getting errors and don’t know how to refer to the sql in the script and re-run it based on the input to Edit1; and then apply to the tablegrid result output.

Any help is gratefully recieved

Thanks

Re: How to filter table grid results

Hi RColema3,
If you zip your project (without the .exe) someone will be able to take a look, but by the sound of it, in your sqlquery code, your 'where clause' should contain something like:
where  tablename.fieldname = "{edit1}"   or tablename.fieldname like "%{edit1}%".
Alternatively, you could structure it differently and eliminate the need for any sqlquery and just do it on a standard 'search' (please see the attachment as a suggestion).
It may not be quite what you're intending but might give you some pointers.
Derek.

Post's attachments

Attachment icon certificates.zip 731 kb, 243 downloads since 2022-01-23 

Re: How to filter table grid results

Hi derek

Thank you so much for this - this is exactly what I was missing. I was trying all sorts of commands when all I needed was {edit1} in the sql.

This is a fantastic application smile thank you