Help! How do I...

joe_madeira

Registered User.
Local time
Today, 05:43
Joined
Dec 6, 2011
Messages
29
Hey,

I want a Form which displays three different List boxes. Each list box is made up of three different queries. I don't want to display all three list boxes at a time. Instead I want each list box to only display onto the middle of the screen when an OnClick button is pressed.

For example. In this form I would have three buttons on the left. Each button brings up a different List box in the middle of the screen. When you press one button a list box comes up. When you press another button that list box either disappears and displays another list box or that list box changes to the other list box.

this is so that I dont have to make three separate forms for each list box. I can't use all three list boxes in one form because there isn't enough space because every form within my database must be of a specific size.

Any Help is appreciated! Thanks!

P.S. I know this can be done using a text box whereby pressing a button would change the text in a text box. But I want to know if it can be done using a list box.
 
Hey,

I want a Form which displays three different List boxes. Each list box is made up of three different queries. I don't want to display all three list boxes at a time. Instead I want each list box to only display onto the middle of the screen when an OnClick button is pressed.

For example. In this form I would have three buttons on the left. Each button brings up a different List box in the middle of the screen. When you press one button a list box comes up. When you press another button that list box either disappears and displays another list box or that list box changes to the other list box.

this is so that I dont have to make three separate forms for each list box. I can't use all three list boxes in one form because there isn't enough space because every form within my database must be of a specific size.

Any Help is appreciated! Thanks!

P.S. I know this can be done using a text box whereby pressing a button would change the text in a text box. But I want to know if it can be done using a list box.


I can imagine two ways to do this, and both require VB Code
  1. Create Three List Boxes that Overlay each other at the Desired screen positon
    1. In the Open Form Event, Hide All Three List Boxes and their Labels.
    2. When any of the three Buttons is clicked, Un-Hide its associated List Box and Label, and Hide the other two.
    3. Re-Query the List Boxes
  2. Create a Single List Box at the Desired screen positon
    1. In the Open Form Event, Hide the List Box and its Label.
    2. When any of the three Buttons is clicked, modify the Source of the List Box to be a Query associated with the Button that was clicked, and Un-Hide the List Box and its Label.
    3. Re-Query the List Box
 
MSAccessRookie

Thanks man! two great ideas that never crossed my mind.
Just one thing, how would i modify the Source of the List Box to be a Query associated with the Button that was clicked, and Un-Hide the List Box and its Label? How is this done on VB? Can you give me an example of the coding behind that?
 
Last edited:
There are many good examples of such coding in this forum. You should be able to search for "Hiding Controls" and "Changing RecordSource", as well as variations of those two until you find an example that explains what you need to know
 

Users who are viewing this thread

Back
Top Bottom