[Solved] ListBox not working after adding 2 columns to query

Discuss the database features
Post Reply
User avatar
karinincanada
Posts: 9
Joined: Fri Aug 13, 2010 6:05 am

[Solved] ListBox not working after adding 2 columns to query

Post by karinincanada »

I've based a ListBox on a query (qryAuthors) that had two columns: AuthorID and a concatenated column called Fullname. It was working fine.

The ListBox SQL: SELECT "Fullname", "AuthorID" FROM "qryAuthors"

I wanted to sort the records by last name/first name, so I added two more fields in the query to accomplish this, which seems to have broken the ListBox:
Query in which I am sorting the data by last name, and then by first name.
Query in which I am sorting the data by last name, and then by first name.
author sort.PNG (9.72 KiB) Viewed 2532 times
Query as it is now, with 4 columns
Query as it is now, with 4 columns
query output.PNG (6.21 KiB) Viewed 2532 times
Since I added these two fields the list box doesn't display the list anymore or display the data in the field. I tried unchecking the view checkboxes but this didn't seem to do anything.

Any ideas?
Last edited by karinincanada on Sat Aug 14, 2010 6:34 pm, edited 1 time in total.
***Using OpenOffice 3.1.1 on Windows 7 Ultimate***
QuazzieEvil
Volunteer
Posts: 283
Joined: Tue Dec 04, 2007 6:38 pm
Location: Houston, TX

Re: ListBox not working after adding 2 columns to query

Post by QuazzieEvil »

uncheck the 'visible' check box for those 2 last columns
User avatar
karinincanada
Posts: 9
Joined: Fri Aug 13, 2010 6:05 am

Re: ListBox not working after adding 2 columns to query

Post by karinincanada »

Yeah, I tried that before. I tried it again just now, and it didn't change anything -- the list box is still not working.
***Using OpenOffice 3.1.1 on Windows 7 Ultimate***
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: ListBox not working after adding 2 columns to query

Post by Villeroy »

Sometimes I have a small list box to display one line while the drop down property is not set. This occurs after I converted some other type of control to a list box.
Drag the multi-line box taller or set the drop down property.
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
User avatar
karinincanada
Posts: 9
Joined: Fri Aug 13, 2010 6:05 am

Re: ListBox not working after adding 2 columns to query

Post by karinincanada »

Dropdown property is set to yes, and I made it taller, and that made no difference.

However, if I delete the 2 "sorting" columns from the query, save the query, and reopen the form, the form works fine.

I'm uploading the database - it's very small and simple at this point. Maybe someone could take a peek under the hood.

Right now there are 2 queries - the one named qryAuthors does not have the 2 extra columns and you'll see that the list box on the form works.

If you rename the qryAuthors query to something else, and rename the other query (which has the 2 "sort" columns) to qryAuthors, you'll see how it makes the list box stop functioning. :crazy:

PS -- I thought I updated my signature, but just fyi, I have version 3.2.
Attachments
New UU Library Database.odb
(17.72 KiB) Downloaded 145 times
***Using OpenOffice 3.1.1 on Windows 7 Ultimate***
Arineckaig
Volunteer
Posts: 828
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: ListBox not working after adding 2 columns to query

Post by Arineckaig »

Since I added these two fields the list box doesn't display the list anymore or display the data in the field.
I am not entirely sure if I understand the problem correctly, but have attached a revised copy of your Base file. You will see that the only only change is to add an ORDER BY clause to the SQL command that fills the list box on the form. My apologies if this answer is off beam.
Attachments
New UU Library DatabaseRevised.odb
Addition to list box SQL command
(17.71 KiB) Downloaded 146 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
User avatar
karinincanada
Posts: 9
Joined: Fri Aug 13, 2010 6:05 am

Re: ListBox not working after adding 2 columns to query

Post by karinincanada »

Aha!! I get it! :bravo:

I've been going about this all wrong! I didn't even NEED a query, I can do it all in the SQL (Structured QUERY Language, duh). Obviously I'm a noob in the SQL department. I went into the SQL statement and modified what you did so that it sorts by the Last name, and THEN by the First name, and now it works PERFECTLY, no query required.

Thank you very much! :o My whole procedure is altered now. I'll be doing my Access databases this way from now on - less objects to deal with, hurray.

Here is the SQL for any followers of the post:

SELECT "AuthorFirstName" || ' ' || "AuthorLastName" AS "Fullname", "AuthorID" FROM "Author" AS "Author" ORDER BY "AuthorLastName" ASC,"AuthorFirstName" ASC

And here's what it looks like in the SQL build screen (sorry I don't know the ooBase term for this):
query on list box.PNG
***Using OpenOffice 3.1.1 on Windows 7 Ultimate***
Post Reply