Create query with macro

Creating tables and queries
Post Reply
kevinT220
Posts: 11
Joined: Wed Nov 18, 2020 5:43 am

Create query with macro

Post by kevinT220 »

it possible to use macro to create query?
like example , i have a query to select "abc" , If i select other data just need change the "abc", can i direct get from data form and put in query without create the new query.
That mean like create a variable then always change the variable data.
Any idea?
Apache OpenOffice4.1.7
UnklDonald418
Volunteer
Posts: 1546
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: create query with macro

Post by UnklDonald418 »

No macro needed.
If you are using Base. a parameter query will allow you to search for a string entered at run time

Code: Select all

SELECT * FROM "SomeTable" WHERE "SomeField" LIKE :Enter_A_Search_String
will generate a popup dialog prompting the user to Enter_A_Search_String.
The parameter is simply a colon ":" followed by a prompt phrase (no spaces allowed)

A more sophisticated approach would be to use a Filter Table.
[Example #2] Filter/Search with Forms (leveraging SubForms)
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
kevinT220
Posts: 11
Joined: Wed Nov 18, 2020 5:43 am

Re: create query with macro

Post by kevinT220 »

Hi, how if i wan get data from form, i dw user to enter.? Like i got 1 list box and 1 form link with query, that query can get data selected in list box
Apache OpenOffice4.1.7
UnklDonald418
Volunteer
Posts: 1546
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Create query with macro

Post by UnklDonald418 »

It isn't clear what you are attempting. It might help if you would upload a sample of your database and form
[Forum] How to attach a document here
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Post Reply