By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,481 Members | 979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,481 IT Pros & Developers. It's quick & easy.

Listbox with checkbox displayed

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
> 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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.