473,706 Members | 7,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox with checkbox displayed

Hello;

I am creating a multiselect listbox and I would like to use checkboxes
to indicate which items are selected (rather than the default highlighting.)
I would then place these selected items in a table.

I would also like to have the ability to "select all" and "deselect all".

Any help on accomplishing the above would be greatly appreciated. Thanks;

Thomas
Nov 13 '05 #1
4 14541
Thomas,

You would be better served to use a pop-up continuous form rather than a
listbox. Add a field called Selected to your table and make it Yes/No. Include
Selected on your form and it will appear as a checkbox. For "select all" and
"deselect all", you can add a button to your form that executes an update query
that sets Selected to True for all records for "select all" and to False for all
records for "deselect all". To execute your code for the selected items, you can
add a button that executes the code for all records where Selected is True. For
this you can use a query and set the criteria for Selected to True. At the end
of this code you will want to reset Selected for all records back to False so
you again use an Update query.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"Thomas" <no*@home.com > wrote in message
news:MT******** **********@nnrp 1.uunet.ca...
Hello;

I am creating a multiselect listbox and I would like to use checkboxes
to indicate which items are selected (rather than the default highlighting.)
I would then place these selected items in a table.

I would also like to have the ability to "select all" and "deselect all".

Any help on accomplishing the above would be greatly appreciated. Thanks;

Thomas

Nov 13 '05 #2
Hi;

Thanks for the suggestions; however, I'm not sure if that solution will
work for me. I should put the problem in context:

In the simplest terms, I have a table containing players and another
containing games. I would like track which players attended which games.

I thought this could be best accomplished by having a multiselect list
of players whereby I could select the players for a particular game and
using an action button, have the selected players saved in a table
(gameDetails).

Note that this is the simplistic presentation of what I am trying to
accomplish - it will encompass many teams and players and I will have to
derive trends and calculations from games played over the course of a
season.

I will end up tracking many different types of stats other than
attendence, but establishing which players were at any given game seems like
a fundamental first step.

Cheers;

Thomas

"PC Datasheet" <no****@nospam. spam> wrote in message
news:Wn******** ***@newsread2.n ews.atl.earthli nk.net...
Thomas,

You would be better served to use a pop-up continuous form rather than a
listbox. Add a field called Selected to your table and make it Yes/No. Include Selected on your form and it will appear as a checkbox. For "select all" and "deselect all", you can add a button to your form that executes an update query that sets Selected to True for all records for "select all" and to False for all records for "deselect all". To execute your code for the selected items, you can add a button that executes the code for all records where Selected is True. For this you can use a query and set the criteria for Selected to True. At the end of this code you will want to reset Selected for all records back to False so you again use an Update query.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"Thomas" <no*@home.com > wrote in message
news:MT******** **********@nnrp 1.uunet.ca...
Hello;

I am creating a multiselect listbox and I would like to use checkboxes to indicate which items are selected (rather than the default highlighting.) I would then place these selected items in a table.

I would also like to have the ability to "select all" and "deselect all".
Any help on accomplishing the above would be greatly appreciated. Thanks;
Thomas


Nov 13 '05 #3
> I am creating a multiselect listbox and I would like to use checkboxes
to indicate which items are selected (rather than the default highlighting.) I would then place these selected items in a table.


I'd suggest using two list boxes side by side with command buttons in
between the two list boxes (Select All, Select None, >>, <<) to add or
remove selected records from one listbox to another. You'll need to set up
some queries/code so the list boxes reflect the selections requested. I've
done this on occasion and it works pretty nicely. Here's some (incomplete)
pseudo code that may give you an idea of how to do this:

Private Sub cmdAddSomething _Click()
If IsNull(Me!lstSo mething) Then
MsgBox "Please select an available something.", vbExclamation, "
Nothing Selected"
Exit Sub
End If
DoCmd.SetWarnin gs False
DoCmd.RunSQL "UPDATE tblSomething SET tblSomething.Se lect = -1
WHERE ((tblSomething. Record_ID)=Form s!frmSomething! lstSomething);"
DoCmd.SetWarnin gs True
Me!lstSomething .RowSource = "qrySomethi ng"
End Sub
Nov 13 '05 #4
Thanks - I ended up implementing something similar but your example allowed
me to clean it up.

Thomas

"deko" <no****@hotmail .com> wrote in message
news:cF******** ***********@new ssvr29.news.pro digy.com...
I am creating a multiselect listbox and I would like to use checkboxes to indicate which items are selected (rather than the default highlighting.)
I would then place these selected items in a table.


I'd suggest using two list boxes side by side with command buttons in
between the two list boxes (Select All, Select None, >>, <<) to add or
remove selected records from one listbox to another. You'll need to set up
some queries/code so the list boxes reflect the selections requested.

I've done this on occasion and it works pretty nicely. Here's some (incomplete) pseudo code that may give you an idea of how to do this:

Private Sub cmdAddSomething _Click()
If IsNull(Me!lstSo mething) Then
MsgBox "Please select an available something.", vbExclamation, "
Nothing Selected"
Exit Sub
End If
DoCmd.SetWarnin gs False
DoCmd.RunSQL "UPDATE tblSomething SET tblSomething.Se lect = -1
WHERE ((tblSomething. Record_ID)=Form s!frmSomething! lstSomething);"
DoCmd.SetWarnin gs True
Me!lstSomething .RowSource = "qrySomethi ng"
End Sub

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2008
by: Colleyville Alan | last post by:
I have an app in which users are displayed a list of mutual fund from which they can choose. There is a listbox embedded in a two-tabbed notebook control. When the form is initally opened, the listbox loads info: Private Sub Form_Open(Cancel As Integer) TabControl.Value = 0 Tab_Label1.Caption = "Select Alternatives from the Select List" FundAlternativesList.RowSource = "Load_Select_Alternatives_Form" Call Highlight_Defaults End Sub
2
23355
by: John R. | last post by:
I want to have a listbox that shows a checkbox and a textbox. I created a user control that has a checkbox and a textbox in it and have been trying to add it to a listbox but I can't get it to show up for each item I add to the listbox. foreach (Column column in columns) { ColumnsListBox.Items.Add(column.Name); ColumnsListBox.Controls.Add(new ColumnListControl(true, column.Name,
2
9039
by: Edmilson | last post by:
Hello All I have a Datalist where each "Item" contains a checkbox (among other things). I want the user to be able to click on one or more checkboxes, click the Send button, and have something done to the Items that had the check boxes selected. Seems like a common task. I was easily able to do something like this in classic ASP. But I'm lost in ASP.NET. I´m using VB and I hope you can point me in the right direction...
6
7208
by: segue | last post by:
Hi; I need to change the order of a listbox array from a form app where I select order up or down. What's a good way to do that? Regards; Segue
3
2294
by: Ali Chambers | last post by:
Hi, I have created a listbox called "dtlist1" on my VB.NET form. I call a procedure as follows: Private Sub openfile(flname As String) dtlist1.Items.Clear() etc..
1
2597
by: Priya | last post by:
I have to display a checboxlist with someitems when each item in a listbox is selected. I have a listbox with a list of categories and when i click each category from the listbox, the checkbox list should populate the list of services in the checkbox list.My problem is due to postback i am not able to retain the values of checkboxes selected earlier. I should be able to select multiple items from listbox and multiple items from checkbox...
1
1985
by: John | last post by:
Using Access 2007 I find that, on opening a form, a listbox control always displays one of the values in the list, even if no value has been selected. Thus, the first value in the list is displayed (without highlighting) when the field has a null value. The user may then change the displayed value by clicking on the up or down arrow to the right of the control. This newly displayed value will also be without highlighting and will be...
1
1769
by: pradeep | last post by:
Hi, I want to display Listbox containing check boxes in HTML. How can i do this ? Can you guide me.
8
6032
by: PeteOlcott | last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html I would like to completely understand how GUI controls such as this one are constructed. In the ideal case I would like to see all of the source code for a complete working example of a ListBox of CheckBoxes.
0
8778
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8693
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9281
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9044
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,...
1
6613
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
5935
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
4444
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
4707
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3141
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

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.