473,320 Members | 2,107 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,320 software developers and data experts.

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 14472
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******@pcdatasheet.com
www.pcdatasheet.com

"Thomas" <no*@home.com> wrote in message
news:MT******************@nnrp1.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.news.atl.earthlink.ne t...
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******@pcdatasheet.com
www.pcdatasheet.com

"Thomas" <no*@home.com> wrote in message
news:MT******************@nnrp1.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!lstSomething) Then
MsgBox "Please select an available something.", vbExclamation, "
Nothing Selected"
Exit Sub
End If
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblSomething SET tblSomething.Select = -1
WHERE ((tblSomething.Record_ID)=Forms!frmSomething!lstSo mething);"
DoCmd.SetWarnings True
Me!lstSomething.RowSource = "qrySomething"
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*******************@newssvr29.news.prodigy. 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!lstSomething) Then
MsgBox "Please select an available something.", vbExclamation, "
Nothing Selected"
Exit Sub
End If
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblSomething SET tblSomething.Select = -1
WHERE ((tblSomething.Record_ID)=Forms!frmSomething!lstSo mething);"
DoCmd.SetWarnings True
Me!lstSomething.RowSource = "qrySomething"
End Sub

Nov 13 '05 #5

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

Similar topics

7
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...
2
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...
2
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...
6
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
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
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...
1
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...
1
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
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.