473,671 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListBox Defualt Value (All Selected)

ChaseCox
294 Contributor
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 1400
ADezii
8,834 Recognized Expert Expert
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 Contributor
Thanks, that worked like a charm. I really appreciate the help.
Nov 6 '07 #3
ADezii
8,834 Recognized Expert Expert
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
7861
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 allso subclassed the window and do see all kinds of WS_??? messages coming by. But now I'm stuck :-\ I've got *no* idea what to do next, and all my searching on the web leads me
5
3523
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 double-clicks on one of the variables in listbox A it "moves" it to listbox B. What is going on behind the scenes is that the table that holds all these variables has a yes/no field call Print. When the user double clicks on the value it fires a...
4
2449
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, what do I need to do in order to return the "option value" of the control? Moe !--- returned value of the control
4
4203
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), SqlConnection (sqlConnection), SqlDataAdapter (daLookupData), SqlDataAdapter (daData), DataSet (dsLookupData), and DataSet (dsData), all created via the IDE during design-time. Here is the design of my simple tables: (An example since I can't post my...
6
5206
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 have also tried changing the second ListBox to an HtmlSelect control) using bog standard JavaScript code like so where "used" is the name of my <select> control: used.options = new Option(name, typeId); This all works fine and I can move across...
28
2286
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 is created during runtime. There is no DataAdapter. On an SQL server I would just pull a Unique Set but that doesn't seem to be an option in my case. So I created the code below. It works but it is very slow bringing up the list box. Is there a...
2
6313
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 listbox) like this... <select name="title"> <option value="1"<?php if ($_POST == '1') { echo 'selected="selected"'; } ?>></option> <option value="Mr"<?php if ($_POST == 'Mr') { echo 'selected="selected"'; } ?>>Mr</option>
8
1877
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 selected, how can I get all of them selected? The listbox selectionMode= mulitple for (int i = 0; i < Id.Length; i++) { CarList.SelectedValue = Id;
1
3672
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" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2808
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.