Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display list box items side by side

Status
Not open for further replies.

skyline666

Programmer
Oct 22, 2007
141
GB
Hi,

Im using Access 2003. I have a list box on a form which pulls data out of another table. There are 5 values, but 1 or 2 more may be added in the future. What I would like to do is have the list box not list the 5 entries downwards, but going from left to right instead. Is this possible? If not is there any alternatives?

Many thanks,

Andrew
 
So you don't want the user to select any of the items? It's just for show? If they're listing horizontally, how would you know which item the user wants?
Since the items are, presumedly, on different records, you can concatenate them in a query and use that has the record source. Or, if they're only 5 items, just type them in as a value.
 
How are ya skyline666 . . .

Even in Excel, listbox [blue]selections are by row![/blue] . . . not by column . . .

When programming a database, you need to [blue]switch your thinking from spreadsheet mode to database mode! . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I have never heard of a "horizontal" listbox.

Perhaps if you explain the reason for this unorthodox approach we could come up with a suggestion.

 
A horizontal listbox? I am interested to see the result[wink]

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Hi everyone,

The 5 entries are categories from a category table. At the moment there is a next/previous category button, and the category is displayed at the top of the form. What I want is to remove the buttons and let the user click on the category name instead (with them all being listed). I wanted them horizontally as thats the best way its going to fit on the form.

Obviously if theres another/better way to do it than this, that also has the ability for the possibility of further categories added, then im open to ideas.

Thanks,

Andrew
 
Replace the listbox with a combobox.

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
I also want the users to be able to just click the category name, not have to open the combo box and click the category, thats why I wanted a list box originally.

A messy way that could work is to have 5 list boxes, and set the rowsource to "select cat from table where catid = 1" on first list box, "where catid = 2" on 2nd list box etc. The only problem I see there is that if you delete a category, the list box for that category would be empty. Is there any way of saying "where row = 1", "where row = 2" etc? That may work, and eliminates the problem of the empty listbox.

In saying that I can see a problem with that, what if the category name in row 3 is longer the row 2, and row 2 gets deleted, it wont display properly in the list box. Well, if there is a way to do the "Where row = 1", then im happy for now and i'll speak with the guy im doing this for.
 
This is not a messy way but "messy squared"..

I'd have suggested option group if the number of categories not going to change. You can even think of that.. still it is not a good idea.

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Tabs? [ponder]

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
I suppose if you want to get that messy, you could use a textbox and then fiddle with SelStart and a recognizable delimiter to determine which category was clicked.
 
HarleyQuinn, the tabs might work. Can you, on open of the form say, make a number of tabs dependent of the number of categories? So say there is 5 entries one day, when you open the form it makes the 5 tabs and populates the name with the category, and the next day theres 6 entries, so a new tab is automatically made? I also assume that you would just have the tab part at the top, so that the rest of the for is unchanged.

I also thought of maybe having a subform in. Im pretty sure I saw a thread that asked if you can make the rows the columns and vice versa like you easily can in Excel but can't find it. So is this possible? If so then I can just make the rows go along the top and that may solve it (by using a continuous form aswell maybe).

I'll look into the SelStart Remou, as ive never used it before. But if one of the above (in this post) works then i'll go with that as I don't really like to make the database "messy".

Thanks everyone,

Andrew
 
I think Zameer is being too kind, this is not; this is not "messy squared" but rather "messy to the tenth power!" I'd still go with the Option Group idea. You'll just have to deal with the extra inconvenience of maintenance to get convenience of having it appear horizontal rather than vertical!


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
I think that you may find tabs even messier when you have a variable number of categories as you will have to guess the maximum number that you will need and show or hide them as appropriate.
 
You can dynamically create/rename/remove the tabs (or pages as they're called in Access, this will help alot with syntax [wink]) with VBA, based on the number/names of categories you've got that day.

You could just have it at the top and just keep track of what tab you're on, it's not how it's designed to work but it could be used this way.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Ok. Here is an idea. Create a set number of command buttons and two extra called next and previous, or such like. Clicking these extra buttons sets the captions of the other buttons to the next lot of appropriate categories. With a little event coding, this should work.
 
Yes HarleyQuinn. There is a subform on the form, which has master/child links with Category (has them with an unbound text box which stores the categoryid for the selected category). I didn't mention this as I assumed that any change would make a difference as the links are with the unbound text box, and not the next/previous buttons and the text box for the display of the category.

If you can create and then rename the tabs on the on open of the form that would be great. I reckon that the click of the tab will allow me to assign the categoryid to the unbound text box as it happens now. Also just the one click to select the category is exactly what I want aswell, as the user will have to input data into the form very fast (not by choice mind you!) and so speeding up little things in places like this drastically helps.
 
You can set the caption of a command button and set the tag to the the category id. Clicking the button uses simple code to copy the tag to the textbox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top