need help with listbox.Is it possible to select a row and blank out the rest

xwnoob

Registered User.
Local time
Today, 12:56
Joined
Nov 7, 2011
Messages
70
How do i blank out records in a listbox that are not selected. For example, i have selected a particular row in the listbox that has 5 rows. Access will then hide the rest of the rows while only showing the selected row?
 
I wouldn't use a Listbox, I'd use a Combobox instead:
  1. Create a Query for the RowSource.
  2. In the Query create a Calculated Field.
  3. In the Combobox include Fields, if any, you need to utilize and include your Calculated Field.
  4. Adjust the Column Widths so that only the Calculated Field displays.
The Calculated Field would look something like this:

DisplayColumn:Field1 & " " & Field2 & " " & Field3

Alternatively you could
  1. Superimpose a Listbox over a series of Textboxes that display the various Columns.
  2. When the Listbox is Null, make it Visible and Textboxes Invisible
  3. When not Null, make it Invisible and Textboxes Visible.
  4. Use the OnDoubleClick event of one or all of the Textboxes to go back to the Listbox being Visible and the Textboxes Invisible.
Personally, I'd go with the first example.

Linq ;0)>
 
I wouldn't use a Listbox, I'd use a Combobox instead:
  1. Create a Query for the RowSource.
  2. In the Query create a Calculated Field.
  3. In the Combobox include Fields, if any, you need to utilize and include your Calculated Field.
  4. Adjust the Column Widths so that only the Calculated Field displays.
The Calculated Field would look something like this:

DisplayColumn:Field1 & " " & Field2 & " " & Field3

Alternatively you could
  1. Superimpose a Listbox over a series of Textboxes that display the various Columns.
  2. When the Listbox is Null, make it Visible and Textboxes Invisible
  3. When not Null, make it Invisible and Textboxes Visible.
  4. Use the OnDoubleClick event of one or all of the Textboxes to go back to the Listbox being Visible and the Textboxes Invisible.
Personally, I'd go with the first example.

Linq ;0)>

Yea but i think for me its better to use the listbox. However your second example is quite confusing....is there any other method? I cant seem to find the solution yet
 
You original question exactly describes the functionality of a combobox. It only works for a single selection but that is what you described. If you are only going to select one row then that is definitely the way to go. Why make it complicated?

However I don't see how you plan could work with multiple selections. If you remove the unselected rows what will the user click to select more?

Maybe you are hoping to retain the rows and change their appearance. Unfortunately a listbox does not support selectively formatting different rows so you cannot have the unselected rows greyed out or anything like that.

You can do that in a subform using conditional formatting. A subform can be made to look like a listbox and function resaonably similarly. It is best done using a fabricated ADO recordset.
 

Users who are viewing this thread

Back
Top Bottom