| View previous topic :: View next topic |
| Author |
Message |
Billaboard General User

Joined: 12 Feb 2012 Posts: 6
|
Posted: Fri Feb 17, 2012 8:18 am Post subject: Beginner: List Box question |
|
|
I have a form with 3 fields, Location (Primary Key), Title, Format in a table called LocationTable.
I have a subform containing the main data in a bunch of fields including Index (Primary Key) and Location, Location is related to Location in the other table.
The form and subform list the contents of the two tables and, if I select any location in the main form, the contents of that location are displayed in the subform.
If I now create a listbox based on my LocationTable and displaying the Location, I get no option to pull down any list - it just follows what is selected in the main form.
The database is called Music and the Control area of the listbox contains the following SQL.
SELECT `Location`, `Location` FROM `Music`.`locationtable`
I'm using MySQL for the database, but it seems to be the same using Base with its own database.
I'm obviously not understanding something basic here. Any help? |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
|
| Back to top |
|
 |
Billaboard General User

Joined: 12 Feb 2012 Posts: 6
|
Posted: Fri Feb 17, 2012 1:14 pm Post subject: |
|
|
Hello Romke, I have read through that guide and understood most of it, but I am afraid that I feel even more stupid.
The basic problem remains that I can use the form wizard to create a grid display of the main form and subform, and they link together fine.
I then use the ListBox wizard to create a Listbox, but the ListBox pull down does nothing and the data shown in the ListBox follows the selection in the main form rather than leading it.
I have followed pictorial and video tutorials about this and then tried to follow parallel procedures, but cannot get the ListBox to work the way I expect.
As is obvious, I am really at a very early learning stage with this and I do appreciate the help/
Bill |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Fri Feb 17, 2012 1:32 pm Post subject: |
|
|
Hello
| Quote: | | but cannot get the ListBox to work the way I expect | Then change those thing you expect that is much more easy then changing OOo. In other you do not understand how OOo is working
Study the tutorials where I did point to in the link.
The purpose of a listbox is:
a) Show a value from an other table.
b) Changing the table while you select a value from an other table.
| Quote: | | I then use the ListBox wizard to create a Listbox, but the ListBox pull down does nothing and the data shown in the ListBox follows the selection in the main form | So it works
| Quote: | | rather than leading it | This is a wrong expectation.
I have no idea how to get what you want.
Romke |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
|
| Back to top |
|
 |
Arineckaig OOo Advocate

Joined: 01 Mar 2004 Posts: 331
|
Posted: Sat Feb 18, 2012 2:40 am Post subject: |
|
|
Billaboard | Quote: | | the data shown in the ListBox follows the selection in the main form rather than leading it. |
Please forgive me if I do not fully appreciate what it is that you want the listbox to do. From the quote above it would appear that you wish the content of your MAIN form to be selected/filtered by a selection made from a drop-down listbox. If that is so, I would suggest that in Base a listbox is not well suited to that purpose unless resort is made to macro programming. In Base a listbox is essentially a form control suitable for displaying, adding or changing data in a field of the database - of itself it cannot filter the recordset displayed by the form in which the listbox is located (contained).
On the other hand you will already have seen that any change of the record selected in your MAIN form automatically selects and filters the record(s) displayed in the SUBFORM. Thus, the main form is performing on the sub-form the task that I suspect you may be asking of the listbox to do on the main form. The solution is to insert a further main form above what you have at present so the previous main form becomes its sub-form and the previous sub-form a sub-sub-form. The Base wizards are too limited to do this, but it can be done by opening the form document in edit mode. The links that RPG gave you indicate how to modify a form document in edit mode. Please come back if you wish further guidance.
If all goes well, the newly created main form should be based on the same data source as its sub-form (previously the main form) and again comprises a grid/table but it only needs to contain a single text box "Location" column. Selection of any item from this column will automatically filter and update the recordset(s) displayed in any subform provide the subform is suitably linked. Selection from the Locations column in the main form is simplified if the 'Sort' property under the 'Data' tab of the form's 'Form properties' dialog is set to the "Location" field to be sorted alphabetically.
The operation is more complicated to explain than to do, but without making use of a form document's 'edit mode' only the simplest of forms and form documents are available in Base. _________________ When this issue has been resolved, it helps other users of the forum if you add the word [Solved] to the Subject line of your 1st post (edit button top right).
OOo 3.4.1 and MySQL on MS Windows XP and Ubuntu |
|
| Back to top |
|
 |
Billaboard General User

Joined: 12 Feb 2012 Posts: 6
|
Posted: Sat Feb 18, 2012 11:52 am Post subject: |
|
|
Many thanks for these replies. I will settle down to read through all the references again.
I will have to get this, or some other interface to work graphically, but the data will have to be entered as it becomes available, which will take me away from this, or at least slow me down.
I am not having much luck with any of this. For example I tried to follow the instructions for adding an additional mainform, but right clicking on the Forms screen brings up no 'new' option as described in RPG's document.
I think the ListBox problems I'm having are because I was used to programming in Borland C++ some years ago, and expected ListBoxes to work similarly to that.
Thanks again. |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Sat Feb 18, 2012 1:25 pm Post subject: |
|
|
Hello
If you have experience with programming then it can help you, to see the forms as a programming tool. You are programming with SQL and not with C++.
Romke |
|
| Back to top |
|
 |
|