Selection with Button...

Creating and using forms
Post Reply
andrea707
Posts: 6
Joined: Wed Dec 30, 2009 1:50 am

Selection with Button...

Post by andrea707 »

I have a Combo Box where I choose a list of voices (a specific field from a table). After choosing the voice I should open a list of thing with that voice in common using a button. But I don't know in which way... Please do help me...explaining step by step if possible... In few words: how can I create a button to go to the combo box selection? Thank you very much. Andrea

You don't need to add Not Solved - if it isn't marked as Solved we know it is still open. (TheGurkha, Moderator)
Last edited by andrea707 on Sun Jan 03, 2010 9:03 pm, edited 1 time in total.
OpenOffice 3.0 on MacIntel G5 OSX 10.4
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Selection with Button...

Post by RPG »

Hello

If this question is nearly the same as your first question then there is a more easy way to do it.

a) Make first a query where you can show the list you need.
b) make with the wizard a form and based on that query.
c) show that query in a table control
d) make a subform connect the subform with the mainform with a common value in a field.

If this is doing those things you need you can edit the form later.

The result is now when you select in the main form a value then in the subform you can see those things you need.
Be sure that you have primary keys in forms who you want edit.

See this link.

I hope this helps you
Romke
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
andrea707
Posts: 6
Joined: Wed Dec 30, 2009 1:50 am

Re: Selection with Button...

Post by andrea707 »

Hello Romke.
First of all thank you for replying. I'm understanding better the way to operate and something is happening...
But I don't undestand your
c) show that query in a table control
and
d) make a subform connect the subform with the mainform with a common value in a field.
It would be wonderful an your little resuming about...
Thank you very much, Andrea.
OpenOffice 3.0 on MacIntel G5 OSX 10.4
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Selection with Button...

Post by RPG »

Hello

c) show that query in a table control
I mean use a table control in that form. A table control is what is looking like a spreadsheet. When you design a form with the wizard then you can choose for a table control view. If you design your form by hand activate the wizard for the controls and also more controls for the table control.

The next remark point d is also not so difficult when you use the wizard. The wizard guides you through the problems.

I can understand it is difficult.
You see I use several time the word form. You can better understand it when you also open the form in edit mode. then you can open the form.

I will try to explain it a little more.
You do have a list. This list you want use for making a choice..That was your combobox. i said make a query for this list. When you use this query in your mainform. In your main form you have a grid control then you can select the value you need.

Now comes the subform. You use your subform for displaying data maybe editing data. Your subform and mainform must have comon one value. You organize this in the properties of your subform in the master- slavefield. You chose those two fields.
when you have designed your form wel then you can see that your subform is folowing your main form.

In your first post you talk about 5 values then you can follow this way. When you have more values then you it works not nice this way but basicly you can follow this method of mainform-subform.

In this link you can find a more complicated method but not so difficult.
http://www.oooforum.org/forum/viewtopic ... search+odb

When you want work with databases then you have to learn wha is the best method. This means you have to understand a little of SQL, how the forms are working. How better you understand SQL, the forms and the limits of OOo how more easy it is. See the forms more as queries for displaying your results.

I hope this helps you.
Romke
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
andrea707
Posts: 6
Joined: Wed Dec 30, 2009 1:50 am

Re: Selection with Button...

Post by andrea707 »

Hello Romke.
Thanks for your kind patience with my inexperience... I don't know a lot of things about
"base", so I'm learning in progress (I must realize this project for my school).
With your last reply I'm understanding better some things and now the query is filtering
what I need. The problem is again the same: that button must have a Makro to open the
filtered Form, but OOo has not direct controls for this and I don't know the way to edit
the Makros (I localized the Makro "FormWizard--- Layouter--- OpenFormDocument", but
I think this should be connect with some other command to my Form.
I'm sorry for my asking but I have not too much time to realize this project, so I have to
ask what I need...
I think it would be sufficient to have 5 buttons connected with 5 distinct querys, each for
one classroom... But which is the right Makro? And how to edit it?
Well, thank you very much for you attention and help...
Have a nice day,
Andrea
OpenOffice 3.0 on MacIntel G5 OSX 10.4
Arineckaig
Volunteer
Posts: 828
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: Selection with Button...

Post by Arineckaig »

I hesitate to offer a suggestion as I am not sure I fully understand what you are looking for. I suspect, however, that using a ComboBox with buttons and macros may not be the easiest route. I have attached a very simple example to demonstrate a similar approach to that suggested by Romke. If something along these lines meets your needs let me know and I can easily give more detailed information on how the main form, on the left, is setup and linked to the sub-form on the right.
Attachments
Simple Filter.odb
(92.95 KiB) Downloaded 291 times
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
andrea707
Posts: 6
Joined: Wed Dec 30, 2009 1:50 am

Re: Selection with Button...

Post by andrea707 »

Dear Arineckaig,
thank for writing and for posting an example: it was very important for my understanding!
Now I think I'll use your solution, but I have only a little problem: instead of your Main Form
could I place in the same page of the SubForm a combi box to make the selection?

In your example it would be a ComboBox with the choices "Clubs, Diamonds, ....", and selecting
one of those you can get the right compiled order in the SubForm...

Please do help me: with this I'll finish my work... !

Thank you very much,
Andrea
OpenOffice 3.0 on MacIntel G5 OSX 10.4
Arineckaig
Volunteer
Posts: 828
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: Selection with Button...

Post by Arineckaig »

instead of your Main Form
could I place in the same page of the SubForm a combi box to make the selection?
Not easily. In Base, unlike Access, a ComboBox does not readily act as a means of filtering or selecting records. If your project insists on use of a ComboBox to filter records then Base unlike Access does not provide a direct or simple answer.

In Base the CombBox in a form is designed primarily for entering data into a field to which it is usually bound - its purpose is to speed up data entry by offering a list of pre-selected options for that particular field. This would not appear to be what you are seeking to do. While a ComboBox in Base can be unbound (i.e. not linked) to any field in the database, it still will not work as a filter unless you use a macro to read which item has been selected within the ComboBox so that the macro will then apply a suitable filter to the records to be shown in the form.

Sorry not to be more helpful.

Unless you have built up some experience with writing macros in OOo Base, I would not recommend that route. I suggest two preferable alternatives. One would be the use of a dummy table as recommended by Villeroy - but I will need a little time to look out and post an example that demonstrates how it can be used. An even simpler route would be use of the Form Navigation Toolbar: you simply select an entry in the table as displayed in the form and then click the auto filter icon on the Form Navigation Toolbar to apply that selection as a filter to the displayed records. Another button on that toolbar will remove the filter when required.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Arineckaig
Volunteer
Posts: 828
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: Selection with Button...

Post by Arineckaig »

One would be the use of a dummy table as recommended by Villeroy - but I will need a little time to look out and post an example that demonstrates how it can be used
Further to my last post, I would refer you to this thread:

http://user.services.openoffice.org/en/ ... 13&t=19440

See also:

http://user.services.openoffice.org/en/ ... 39&t=21966
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
andrea707
Posts: 6
Joined: Wed Dec 30, 2009 1:50 am

Re: Selection with Button...

Post by andrea707 »

Dear Arineckaig,
thank you very much for your help.

The solution with the SubForm was ok, but now the rows I need to navigate into the single tabs
selects referring to the MainForm and not into the list of records belonging to that selection (in few words: with
MainForm I choose the class, then the row should change the tab of any pupil... but here it changes the class).

I cannot ask more to you and to the other friends here... I like very much OpenOffice, but I must say it's not
so "user friendly": the Makros are incomprehensible, a lot of connections are not guided enough in their construction.

I don't know the way I will prepare my work, but in this way it's impossible. I fear I will come back to the terrible
Microsoft Access.

Thanks to all!
Andrea
OpenOffice 3.0 on MacIntel G5 OSX 10.4
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Selection with Button...

Post by RPG »

Hello

I agree with you that OOo is not easy to handle.

What I try to explain to you and what is the same as the example of Arineckaig is a method of selecting data. It is a first step. It is also not a solution for all your problem. But it is not normal to except that you can do it in one weekend. So try to work a little longer on your project.

I have never worked with Microsoft Access only for some days and I did not understand it. The reason is not that Access is bad but I did not spent enough time to learn the idea how I should work with Access. For you it is the same you must try to understand the idea how OOo-base is working.

I will continue on the way I was and this is the same idea as what Arineckaig use.

I will not be unfriendly but when I read your post I cannot see a lot of information. I knew you need selection of : voices, class and pupils. But in what order I don't know. That is the reason why I explain it in real common knowledge for OOo-base. You try very time to write macros I like macros but for most people they are to difficult and I do not write your macros. That is the reason why we, more people on this forum, try to work without macros. You can think this is difficult but be sure macros are much more difficult then the things who give problems now to you.

You have learned now how you can select with one mainform and a subform values in a table. This can be a table control or only fields. When you think it is not precise enough then you can use one mainform a subform and again a subform. But important to understand is that you can select in this way those part you need.

I think in this two links you maybe find information what can be important. Also you can read it is not only difficult for you but also for other people.
http://www.oooforum.org/forum/viewtopic ... highlight=
http://www.oooforum.org/forum/viewtopic ... highlight=

I hope this helps but when you want use Microsoft Access I can understand it there it seemes to be more user friendly then OOo-base.

Romke
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
Arineckaig
Volunteer
Posts: 828
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: Selection with Button...

Post by Arineckaig »

I should apologise for not realising that you wished to filter by more than one selection. FWIW I have attached a modified .odb file which includes a form that uses the same principle of form - subform - subsubform - subsubsubform to filter the records by three ANDed pseudo ComboBoxes. An examination of the components of this form document in edit mode will show how Base can handle quite complex filtering. Again I would also refer you to Villeroy's alternative methods described in the links that I referred to in my previous post.

Best wishes for the New Year.
Attachments
Simple Filter2.odb
3 way filter
(109.8 KiB) Downloaded 433 times
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
druber
Posts: 2
Joined: Sat Jan 09, 2010 10:44 pm

Re: Selection with Button...

Post by druber »

I am using the new version of OpenOffice with Windows 7, and I simply cannot get Simple Filter or Simple Filter2 to work. Anyone else had this problem? I do have another database with several tables using a pull down from one table to fill a grid from another table, and it works fine. I am just frustrated I can't get either of these two very simple databases to work. Nothing shows up in the grid. :?
Druber
OpenOffice 3.1 on Windows 7
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Selection with Button...

Post by RPG »

Hello

I have just tried the last example and it is working good.

Maybe you expect the wrong things.

When you select in the little grid a row then you see in the great grid only rows who contain that word.

When you expect they get an other color then you expect wrong things.

Romke
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
druber
Posts: 2
Joined: Sat Jan 09, 2010 10:44 pm

Re: Selection with Button...

Post by druber »

Thanks for your reply. Actually, When I opened the examples the first time, I already had another file open, and for some reason it didn't work. Why is still a question in my mind. In opening them from scratch the second time without anything else already open they worked fine. The second example is really quite slick! Thanks for sharing that little ditty! The only thing I would like help on is how to show, for example, ALL the days of the week, but select one of the cards, and/or months. I'm guessing that gets a little more complicated with queries. Obviously, I'm pretty new at this :mrgreen:

Also, I am running 3.1.1, not the beta version as may have been construed from the previous post. Maybe, since I am not deeply involved with 3.1, I should be learning the beta version instead, but not sure how stable it is yet.
Druber
OpenOffice 3.1 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Selection with Button...

Post by Villeroy »

Use the navigation toolbar:
Last button: Shows an addtional grid view with a "Standard filter" like the one in Calc (much better with pattern matching and LIKE operator).
Magic filter: Click one value and the magic stick button
Form based filter: Click the button, fill out the form with your criteria and apply the filter.

A predefined filter to show all names starting with a given string or all rows for no filter string:
http://user.services.openoffice.org/en/ ... hp?id=6442
Requires one extra table for the sake of binding the search box to some record. The subform (button and grid) is bound to a parameter query, substituting the variable parameter with the main form's search string.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply