473,378 Members | 1,119 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,378 software developers and data experts.

Checkbox on Forms

I created a form that lists all the players from a particular squad in my
database. I used the Wizard to create the form and populate the form with
the results from a sqad query. It works. My next phase is to add check
boxes to the form to allow the user to select the appropriate players that
will play in the next game and send the selected players to a form for
printing. I'm facing two issues. The first is that when I added the
checkbox to the form, each player returned in the form has a checkbox, which
is good. But when I select one checkbox it enables all of the checkboxes.
The second issue is how to I get the selected players to a report that will
list them in a column under Player Name? Any help would be greatly
appreciated.

Thanks

JW

--
<link removed>
Jun 6 '06 #1
19 8925
On Tue, 06 Jun 2006 14:50:04 GMT, jdub via AccessMonster.com wrote:
I created a form that lists all the players from a particular squad in my
database. I used the Wizard to create the form and populate the form with
the results from a sqad query. It works. My next phase is to add check
boxes to the form to allow the user to select the appropriate players that
will play in the next game and send the selected players to a form for
printing. I'm facing two issues. The first is that when I added the
checkbox to the form, each player returned in the form has a checkbox, which
is good. But when I select one checkbox it enables all of the checkboxes.
The second issue is how to I get the selected players to a report that will
list them in a column under Player Name? Any help would be greatly
appreciated.

Thanks

JW


You first need to add a check box field to the underlying table.
Then add that check box field to your form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Jun 6 '06 #2
Ifyou checkbox is not bound to a data field, then setting one sets all
instances.

First, you have to have a true/false field you can bind to for each player.

Second, you probably don't want that in your main data table, which I assume
you're using to populate your form. If the setting is temporary (you're
going to set it, use it a bit, and then you don't care) you can probably get
away with it in the main table. Doubtful. I'd probably make a table to
hold a list of player primary keys and a true/false field. With one action
query you can copy all the player primary key values to the foreign key
field in the new table, and also set the yes/no field to yes, or no,
whichever you prefer for the default.

then, your display, would be driven by the new table, and you could bind
your checkbox to the yes/no field.

And...you'll probably want to create more than one list eventually, so you
might as well create some ListID value and put that in the new table also.
You can either create it on the fly as you append the rows, or you can get
formal and have a ListMaster and ListDetail table pair. When you create a
new list, you put one row in ListMaster, get its primary key, and use that
primary key as a foriegn key in the new rows in ListDetail.

How elaborate do you want to be?
Jun 6 '06 #3
Rick,

Thanks. I'm a newbie and think I follow your suggestions. I'm going to give
the a shot.

Jdub

Rick Wannall wrote:
Ifyou checkbox is not bound to a data field, then setting one sets all
instances.

First, you have to have a true/false field you can bind to for each player.

Second, you probably don't want that in your main data table, which I assume
you're using to populate your form. If the setting is temporary (you're
going to set it, use it a bit, and then you don't care) you can probably get
away with it in the main table. Doubtful. I'd probably make a table to
hold a list of player primary keys and a true/false field. With one action
query you can copy all the player primary key values to the foreign key
field in the new table, and also set the yes/no field to yes, or no,
whichever you prefer for the default.

then, your display, would be driven by the new table, and you could bind
your checkbox to the yes/no field.

And...you'll probably want to create more than one list eventually, so you
might as well create some ListID value and put that in the new table also.
You can either create it on the fly as you append the rows, or you can get
formal and have a ListMaster and ListDetail table pair. When you create a
new list, you put one row in ListMaster, get its primary key, and use that
primary key as a foriegn key in the new rows in ListDetail.

How elaborate do you want to be?


--
Message posted via http://www.accessmonster.com
Jun 6 '06 #4
Fredg,

Thanks for your reply. Once I added the check box field to the table, how do
I get the results to a report?

Can the selections be Control Sources of some sort for the Player Name field
on the report?

Thanks,

JDUB

fredg wrote:
I created a form that lists all the players from a particular squad in my
database. I used the Wizard to create the form and populate the form with

[quoted text clipped - 11 lines]

JW


You first need to add a check box field to the underlying table.
Then add that check box field to your form.


--
Message posted via http://www.accessmonster.com
Jun 6 '06 #5
Typically:

docmd.openreport "MyReport", , , "MyYesNoField=True"

You may have additional criteria, of course, such as

docmd.openreport "MyReport", , , "MyYesNoField=True And ListID = '" &
Me.cboMyListID & "'"
Jun 6 '06 #6
Rick,

I think I have thoroughly confused myself on this one. Steps I followed.

1. Created a field in the main database called Active Roster.
2. The Active Roster field has a datatype of Text
3. Added a Check box to the Roster Form
4. Without an empty Control Source Field, when the report runs, 1 click
selects all
5. When I enter the main database and field name in the control source field
and run the report, I'm unable to select any of them.

Help!!!!!

1. Should I make the data type for the roster field to be YES/NO?
2. What do I do with the checkbox?

Thanks,

JDUB

Rick Wannall wrote:
Ifyou checkbox is not bound to a data field, then setting one sets all
instances.

First, you have to have a true/false field you can bind to for each player.

Second, you probably don't want that in your main data table, which I assume
you're using to populate your form. If the setting is temporary (you're
going to set it, use it a bit, and then you don't care) you can probably get
away with it in the main table. Doubtful. I'd probably make a table to
hold a list of player primary keys and a true/false field. With one action
query you can copy all the player primary key values to the foreign key
field in the new table, and also set the yes/no field to yes, or no,
whichever you prefer for the default.

then, your display, would be driven by the new table, and you could bind
your checkbox to the yes/no field.

And...you'll probably want to create more than one list eventually, so you
might as well create some ListID value and put that in the new table also.
You can either create it on the fly as you append the rows, or you can get
formal and have a ListMaster and ListDetail table pair. When you create a
new list, you put one row in ListMaster, get its primary key, and use that
primary key as a foriegn key in the new rows in ListDetail.

How elaborate do you want to be?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200606/1
Jun 6 '06 #7
Are you truly entering the "main database and field name in the control
source field"? Controls in access bind to fields in tables and queries.

In the simple case, you'd have

tableName
NameID
ContactName
InRoster (this is the yes/no field)

On some subform in continuous form view, you'd put a checkbox in the detail
section, such as chkInRoster, bound to control source InRoster. The form
itself would be bound to the table tableName.

That's a bare-bones desription of a way to do what you're after, I think.

Then, once you check the boxes on theappropriate rows, you run your report:

docmd.openreport "MyRoster", ,,,"InRoster=True"
Jun 6 '06 #8
Thanks for your help.

I'm good all the way up to the actual report. Where does this code go?

I've created a report that should list the selected player names in sequence.

I created a text box under the player name heading. Do I configure the
control source for this field???

What are the steps to put the selected records into the field?

Thanks,

Jdub

w_a_n_n_a_l_l_ -@-_s_b_c_g_l_o_b_a_l._n_e_t wrote:
Are you truly entering the "main database and field name in the control
source field"? Controls in access bind to fields in tables and queries.

In the simple case, you'd have

tableName
NameID
ContactName
InRoster (this is the yes/no field)

On some subform in continuous form view, you'd put a checkbox in the detail
section, such as chkInRoster, bound to control source InRoster. The form
itself would be bound to the table tableName.

That's a bare-bones desription of a way to do what you're after, I think.

Then, once you check the boxes on theappropriate rows, you run your report:

docmd.openreport "MyRoster", ,,,"InRoster=True"


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200606/1
Jun 7 '06 #9
If you're asking me about creating a report the best way is to select your
table in the database window and then click Insert | Report and choose
report wizard. Follow the prompts. Make a report. If you don't like how
it looks, delete it, do it again. The wizard is pretty simple. By the way,
tip: You don't have to display a field to filter by it. In other worods,
this statement:

docmd.openreport "MyRoster", , , "InRoster=True"

works whether InRoster appears on the report as a checkbox (or anything
else) or not. As long as the recordsource of the report is the table
itself, you have all the fields in that table available to you. You display
the players' names on the report by putting a control on the report and
using the player name field as the controlsource.
Jun 7 '06 #10
Thanks for your reply. Maybe I'm not clear in my explanation. I'll try
again.

I've created a form that pulls players names from the database(PlayerName).
On the form by each name I've inserted a Checkbox and it's bound to the
RosterField. RosterField is a YES/NO datatype field. I also created a
command on the same form that will open up a report and supposedly input the
selected players.

The command button on the form is a Preview Report Button: The Event
Procedure code for On Click is below:

Private Sub Preview_Report_Click()
On Error GoTo Err_Preview_Report_Click

Dim stDocName As String

stDocName = "GameRoster"
DoCmd.OpenReport stDocName, acPreview

Exit_Preview_Report_Click:
Exit Sub

Err_Preview_Report_Click:
MsgBox Err.Description
Resume Exit_Preview_Report_Click

End Sub

So far everything is good. The GameRoster opens up but is only displaying
the headers I created. I assume that there has to be a field or fields
designed in the Detail portion of the report that will store the selected
Player Names. Does that make sense? I've created reports and associated the
fields under my column headers with fields from the database. But in this
fashion, how and where in the report do I get the selected player names on
the report?

Thanks,

Jdub
w_a_n_n_a_l_l_ -@-_s_b_c_g_l_o_b_a_l._n_e_t wrote:
If you're asking me about creating a report the best way is to select your
table in the database window and then click Insert | Report and choose
report wizard. Follow the prompts. Make a report. If you don't like how
it looks, delete it, do it again. The wizard is pretty simple. By the way,
tip: You don't have to display a field to filter by it. In other worods,
this statement:

docmd.openreport "MyRoster", , , "InRoster=True"

works whether InRoster appears on the report as a checkbox (or anything
else) or not. As long as the recordsource of the report is the table
itself, you have all the fields in that table available to you. You display
the players' names on the report by putting a control on the report and
using the player name field as the controlsource.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200606/1
Jun 7 '06 #11
Your quote "You display
the players' names on the report by putting a control on the report and
using the player name field as the controlsource."
I reread this statement and understood it this time. Okay, you say "putting
a control on the report". Is a text box with a control source considered a
control? I created a text box under my player name header and tied it to the
Player Name field of the database. I ran my form and selected 5 players.
Click the Preview Report button and there is only 1 of the 5 players selected.
Looks like we're getting close. I'm missing something.

Thanks for your patience by the way. :-)

Jdub
w_a_n_n_a_l_l_ -@-_s_b_c_g_l_o_b_a_l._n_e_t wrote:If you're asking me about creating a report the best way is to select your
table in the database window and then click Insert | Report and choose
report wizard. Follow the prompts. Make a report. If you don't like how
it looks, delete it, do it again. The wizard is pretty simple. By the way,
tip: You don't have to display a field to filter by it. In other worods,
this statement:

docmd.openreport "MyRoster", , , "InRoster=True"

works whether InRoster appears on the report as a checkbox (or anything
else) or not. As long as the recordsource of the report is the table
itself, you have all the fields in that table available to you. You display
the players' names on the report by putting a control on the report and
using the player name field as the controlsource.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200606/1
Jun 7 '06 #12
this would be a lot easier if you would post the table designs (at least the
primary and foreign keys, a few fields of interest, and anything related to
the task).

When you say things like "On the form by each name I've inserted a Checkbox
and it's bound to the RosterField" I can't tell what you've done.

If you're using a continuous subform to display a list of names, you'd have
exactly one checkbox in the detail section next to the player name, if your
underlying table contains the name and the yes/no field.

Without good solid info like that, this is an exercise in futility.

Please - table designs, just for a start.
Jun 7 '06 #13
Okay,

Here is my Main Registration Table and the fields of importance.

Registration Table

PlayerID Autonumber - Primary Key
SSN Text
Player Name Text
..
..
..
..
Squad Text
RosterField Yes/No

More to come..

w_a_n_n_a_l_l_ -@-_s_b_c_g_l_o_b_a_l._n_e_t wrote:
this would be a lot easier if you would post the table designs (at least the
primary and foreign keys, a few fields of interest, and anything related to
the task).

When you say things like "On the form by each name I've inserted a Checkbox
and it's bound to the RosterField" I can't tell what you've done.

If you're using a continuous subform to display a list of names, you'd have
exactly one checkbox in the detail section next to the player name, if your
underlying table contains the name and the yes/no field.

Without good solid info like that, this is an exercise in futility.

Please - table designs, just for a start.


--
Message posted via http://www.accessmonster.com
Jun 7 '06 #14
I created a form called DJF Registration Table222 - The form has a record
source of DJF Registration Table(This is my main registration table)

Form Header
Detail Header
Label - Player Name Text Box with Control Source Player Name
Checkbox with Control Source Rosterfield

Form Footer

Preview Report Button with the following code for the On Click Event
Procedure

Private Sub Preview_Report_Click()
On Error GoTo Err_Preview_Report_Click

Dim stDocName As String
Dim strWhere As String

stDocName = "GameRoster"
DoCmd.OpenReport stDocName, acViewPreview
Exit_Preview_Report_Click:
Exit Sub

Err_Preview_Report_Click:
MsgBox Err.Description
Resume Exit_Preview_Report_Click
End Sub

I'm able to receive the players listed in the DJF Registration Table222 form.
I'm able to select the checkboxes appropriately based upon the player I would
like to listed on the report. The problem comes when I click the Preview
Report button for the GameRoster Report. The GameRoster Report opens and
there is only 1 entry(the first entry in the database), even though I
selected multiple players on the DJR Registration Table222form.

The Record Source for the report is the DJF Registration Table. I created a
text box with control source Player Name.
Does that help any?
jdub wrote:
Okay,

Here is my Main Registration Table and the fields of importance.

Registration Table

PlayerID Autonumber - Primary Key
SSN Text
Player Name Text
.
.
.
.
Squad Text
RosterField Yes/No

More to come..
this would be a lot easier if you would post the table designs (at least the
primary and foreign keys, a few fields of interest, and anything related to

[quoted text clipped - 10 lines]

Please - table designs, just for a start.


--
Message posted via http://www.accessmonster.com
Jun 7 '06 #15
Yes it helps, although I'm still not sure what "Deatil Header" means, but
later for that. This code:
stDocName = "GameRoster"
DoCmd.OpenReport stDocName, acViewPreview

should be printing every record in your registration table, unless you've
restricted the recordsource somehow, but you say that the recordsource of
the report is the table itself.

How many pages do you get in Print Preview?
Jun 7 '06 #16
Detail Header is listed when you're in design view of a form.

I only get 1 blank page.

w_a_n_n_a_l_l_ -@-_s_b_c_g_l_o_b_a_l._n_e_t wrote:
Yes it helps, although I'm still not sure what "Deatil Header" means, but
later for that. This code:
stDocName = "GameRoster"
DoCmd.OpenReport stDocName, acViewPreview


should be printing every record in your registration table, unless you've
restricted the recordsource somehow, but you say that the recordsource of
the report is the table itself.

How many pages do you get in Print Preview?


--
Message posted via http://www.accessmonster.com
Jun 7 '06 #17
I double checked and yes the RecordSource is the registration table for the
report GameRoster. I have defined a text box field on the report which is
the Control Source for the field Player Name, which comes from the
registration table.

w_a_n_n_a_l_l_ -@-_s_b_c_g_l_o_b_a_l._n_e_t wrote:
Yes it helps, although I'm still not sure what "Deatil Header" means, but
later for that. This code:
stDocName = "GameRoster"
DoCmd.OpenReport stDocName, acViewPreview


should be printing every record in your registration table, unless you've
restricted the recordsource somehow, but you say that the recordsource of
the report is the table itself.

How many pages do you get in Print Preview?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200606/1
Jun 7 '06 #18
There is no Detail Header. There are Form Header, Page Header, Detail, Page
Footer and Form Footer. Detail refers to the Detail section, as Form Header
refers to the Form Header section.
Jun 7 '06 #19
OK. Try this. WIth your report in design view, click on the RecordSource.
You should see s button with three dots appear. Click on that button, click
yes (you want to build a query on a table). That opens the query design
grid. You'll throw this one away, but I need to know what you get. From
the list of table fields, drag the "*" down to the grid. then run the
query. How many rows of data do you see?
Jun 7 '06 #20

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

Similar topics

0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
1
by: Jason Dykes | last post by:
I have a page that is database driven. The pages shows a user's name and whether they have access to our site or not. this is done by displaying two checkboxes positioned to the right of the users...
2
by: Menelty | last post by:
I have 2 datagrids on my page and each one has a template column which has a checkbox relating to each specific row. I usually have one on the page and use javascript to make sure there has been x...
4
by: Steph | last post by:
Hello, Can someone tell me the script to use for having a change on the same page when using checkbox function ? For example, i would to check one condition and display dynamically a button...
1
by: kiran | last post by:
I cratee a form to meet the fallowing requirement. 1. If any node is selected the corresponding checkbox should be checked 2. If any checkbox is clicked the corresponding node should be selected ...
4
by: Wolfgang Uhr | last post by:
Hello I've the following code Panel pnlData = new System.Windows.Forms.Panel(); CheckBox checkBox = new System.Windows.Forms.CheckBox(); checkBox.AutoSize = true; checkBox.Dock =...
29
by: Amer Neely | last post by:
I've got a dynamically built form with checkboxes for each element ( a list of file names in a directory). I need to grab only those checkboxes that are checked, so I can then delete those files. ...
9
by: morellik | last post by:
Dear all, I have a program that creates dinamically a web page. In the page I have the following function to check how many checkbox are checked. function tarInfo(info) { var i=0; var c=0;...
1
by: bird | last post by:
Greetings, I'm trying to calculate the total on an php page. I'm able to get the checkbox portion to work properly but I'm having trouble with the textbox "txtshipping". The default is 7.95...
3
by: uremog | last post by:
I have a set of of check boxes. onClick, the checkboxes call check_radio and recup_checkbox. the referenced radios function as group selectors. check_radio just unchecks the radios if someone...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...

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.