473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ListBox Defualt Value (All Selected)

ChaseCox
294 100+
Long Time no Post,

I am working on a new Access form and I would like to utilize List Boxes.

I currently have my list box populated with values from a table. The list box is set up for Multiple Selections.

When the form loads I would like to have all of the items in the List Box be selected. Is this possible?

For example if I had the Following items in my list box:
Dog
Cat
Fish
Turtle

When the form loads I would like to see that all of these items are selected, so that if I reference the list box from a query, it will pull all of the values.

Thanks for the help.

-Chase
Nov 1 '07 #1
3 1385
ADezii
8,834 Expert 8TB
Long Time no Post,

I am working on a new Access form and I would like to utilize List Boxes.

I currently have my list box populated with values from a table. The list box is set up for Multiple Selections.

When the form loads I would like to have all of the items in the List Box be selected. Is this possible?

For example if I had the Following items in my list box:
Dog
Cat
Fish
Turtle

When the form loads I would like to see that all of these items are selected, so that if I reference the list box from a query, it will pull all of the values.

Thanks for the help.

-Chase
To have all the Items in a List Box named List1 on the Active Form, copy and paste the following code to the Form's Open() Event:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Dim intCounter As Integer
  3.  
  4. For intCounter = 0 To Me![List1].ListCount - 1
  5.   Me![List1].Selected(intCounter) = True
  6. Next
  7. End Sub
Nov 2 '07 #2
ChaseCox
294 100+
Thanks, that worked like a charm. I really appreciate the help.
Nov 6 '07 #3
ADezii
8,834 Expert 8TB
Thanks, that worked like a charm. I really appreciate the help.
That's what we are here for.
Nov 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: R.Wieser | last post by:
Hello All, I'm trying to get a "Virtual Listbox" to work. I've currently got a form, and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and LBS_NODATA flags on it. I've...
5
by: Bill | last post by:
I have have two list boxes. One is a listing of all possible variables. We'll call this listbox A. The other is a listing of all the selected variables. We'll call this listbox B. If a person...
4
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item,...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
6
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I...
28
by: cjobes | last post by:
Hi all, I need to populate a listbox from a table column. The column has multiple entries of usernames and I need to pull a unique set of usernames. The table is part of an untyped Dataset that...
2
by: php_Boi | last post by:
i have designed an application that is a dynamic submission form. i have text fields and listboxes. now i am able to retain the values of the listboxes when i populate the listbox "manually"(single...
8
by: Mike | last post by:
I'm passing an array to a listbox such as (1,2,3,4,5,6,7), I want to highlight (select) all the items in the listbox were the value equals (1,2,3,4,5,6,7). I'm able to only get the last value...
1
by: divya | last post by:
Hello, I used the below code to move selected items between two listboxes Left and Right:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPopup.aspx.cs" Inherits="TestPopup" %> ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.