473,320 Members | 1,867 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.

Using checkboxes on subforms

I would like to use "Yes" and "No" checkboxes on a subform. The problem
is that when I click the Yes checkbox on the subform, all of the
checkboxes are checked.

Currently, I have a field "Refused." It is defined as a text field. A
"Y" means that the service has been refused; an "N" indicates it has
been accepted. If the field is Null, the question has not been answered,
i.e. we don't know if it has been refused or not.

I want the user to be able to check the Yes checkbox and have a Y
entered into the field, or check the No checkbox and have an N entered.
This is not a problem. I have used an If statement on the Click events
of each checkbox.

Let's say that one of the boxes is checked in error. I want to be able
to uncheck it and set the field to Null.

I tried changing the field to Number and using an option group and
writing code in the OnClick event and the BeforeUpdate event, but to no
avail. I figured if I could capture the field contents before the field
was changed, I could get it to work but cannot figure out out to capture
that data.

I know that I can have two fields "RefusedYes" and "RefusedNo" but that
means using two fields when only one is really required and will cause
more work down the line when using the data in queries and in code.

Any ideas on how to do this and not have all the Yes or No checkboxes
checked?

Thank you,
Deborah

Nov 12 '05 #1
5 10037
That is the way unbound controls work in continuous forms view, which I
assume is the form of display in your subform. There's just not a
workaround, not an even near simple one, at least.

Bind the checkbox to a Yes/No field and it'll work as you desire. If
necessary, put the Yes/No field in a different table and join the two tables
in the Query that you use for RecordSource.

Larry Linson
Microsoft Access MVP
"Deborah V. Gardner" <dg******@twcny.rr.com> wrote in message
news:40**************@twcny.rr.com...
I would like to use "Yes" and "No" checkboxes on a subform. The problem
is that when I click the Yes checkbox on the subform, all of the
checkboxes are checked.

Currently, I have a field "Refused." It is defined as a text field. A
"Y" means that the service has been refused; an "N" indicates it has
been accepted. If the field is Null, the question has not been answered,
i.e. we don't know if it has been refused or not.

I want the user to be able to check the Yes checkbox and have a Y
entered into the field, or check the No checkbox and have an N entered.
This is not a problem. I have used an If statement on the Click events
of each checkbox.

Let's say that one of the boxes is checked in error. I want to be able
to uncheck it and set the field to Null.

I tried changing the field to Number and using an option group and
writing code in the OnClick event and the BeforeUpdate event, but to no
avail. I figured if I could capture the field contents before the field
was changed, I could get it to work but cannot figure out out to capture
that data.

I know that I can have two fields "RefusedYes" and "RefusedNo" but that
means using two fields when only one is really required and will cause
more work down the line when using the data in queries and in code.

Any ideas on how to do this and not have all the Yes or No checkboxes
checked?

Thank you,
Deborah

Nov 12 '05 #2
The main problem is that you are using an 'unbound' subform - in other words
there is no data table underlying the form object.

The easiest way to do what you want is to create a table containing fields
for each gui element on the subform. Set the Subform.Form.RecordSource
property to the new table, and set the Control.DataSource property for each
of the text / checkboxes on the subform to the appropriate table field.
Access will then automatically update the underlying table values and you
can get rid of the code events setting values. Each of the controls will now
behave independently. Set the Checkbox.TripleState property to allow for
true/false/null values.

Good luck

Enrico Palazzo


"Deborah V. Gardner" <dg******@twcny.rr.com> wrote in message
news:40**************@twcny.rr.com...
I would like to use "Yes" and "No" checkboxes on a subform. The problem
is that when I click the Yes checkbox on the subform, all of the
checkboxes are checked.

Currently, I have a field "Refused." It is defined as a text field. A
"Y" means that the service has been refused; an "N" indicates it has
been accepted. If the field is Null, the question has not been answered,
i.e. we don't know if it has been refused or not.

I want the user to be able to check the Yes checkbox and have a Y
entered into the field, or check the No checkbox and have an N entered.
This is not a problem. I have used an If statement on the Click events
of each checkbox.

Let's say that one of the boxes is checked in error. I want to be able
to uncheck it and set the field to Null.

I tried changing the field to Number and using an option group and
writing code in the OnClick event and the BeforeUpdate event, but to no
avail. I figured if I could capture the field contents before the field
was changed, I could get it to work but cannot figure out out to capture
that data.

I know that I can have two fields "RefusedYes" and "RefusedNo" but that
means using two fields when only one is really required and will cause
more work down the line when using the data in queries and in code.

Any ideas on how to do this and not have all the Yes or No checkboxes
checked?

Thank you,
Deborah

Nov 12 '05 #3
TC

"Larry Linson" <bo*****@localhost.not> wrote in message
news:sa***************@nwrddc02.gnilink.net...
That is the way unbound controls work in continuous forms view, which I
assume is the form of display in your subform. There's just not a
workaround, not an even near simple one, at least.
Sure there is! You can easily display distinct (per-row) values in an
unbound control on a continuous form. It takes a dozen lines of code (if
that). You can even make them updatable! That's more difficult, but still
quite do-able. See the following google message ID:

< 1067659397.218969 @ teuthos > (remove the four spaces)

TC


Bind the checkbox to a Yes/No field and it'll work as you desire. If
necessary, put the Yes/No field in a different table and join the two tables in the Query that you use for RecordSource.

Larry Linson
Microsoft Access MVP
"Deborah V. Gardner" <dg******@twcny.rr.com> wrote in message
news:40**************@twcny.rr.com...
I would like to use "Yes" and "No" checkboxes on a subform. The problem
is that when I click the Yes checkbox on the subform, all of the
checkboxes are checked.

Currently, I have a field "Refused." It is defined as a text field. A
"Y" means that the service has been refused; an "N" indicates it has
been accepted. If the field is Null, the question has not been answered,
i.e. we don't know if it has been refused or not.

I want the user to be able to check the Yes checkbox and have a Y
entered into the field, or check the No checkbox and have an N entered.
This is not a problem. I have used an If statement on the Click events
of each checkbox.

Let's say that one of the boxes is checked in error. I want to be able
to uncheck it and set the field to Null.

I tried changing the field to Number and using an option group and
writing code in the OnClick event and the BeforeUpdate event, but to no
avail. I figured if I could capture the field contents before the field
was changed, I could get it to work but cannot figure out out to capture
that data.

I know that I can have two fields "RefusedYes" and "RefusedNo" but that
means using two fields when only one is really required and will cause
more work down the line when using the data in queries and in code.

Any ideas on how to do this and not have all the Yes or No checkboxes
checked?

Thank you,
Deborah


Nov 12 '05 #4
<CHUCKLE> If it were "even near simple", wouldn't you have found it
worthwhile to remember the details to do it, as you caution you didn't?
"TC" <a@b.c.d> wrote in message news:1074567506.874946@teuthos...

"Larry Linson" <bo*****@localhost.not> wrote in message
news:sa***************@nwrddc02.gnilink.net...
That is the way unbound controls work in continuous forms view, which I
assume is the form of display in your subform. There's just not a
workaround, not an even near simple one, at least.


Sure there is! You can easily display distinct (per-row) values in an
unbound control on a continuous form. It takes a dozen lines of code (if
that). You can even make them updatable! That's more difficult, but still
quite do-able. See the following google message ID:

< 1067659397.218969 @ teuthos > (remove the four spaces)

TC


Bind the checkbox to a Yes/No field and it'll work as you desire. If
necessary, put the Yes/No field in a different table and join the two

tables
in the Query that you use for RecordSource.

Larry Linson
Microsoft Access MVP
"Deborah V. Gardner" <dg******@twcny.rr.com> wrote in message
news:40**************@twcny.rr.com...
I would like to use "Yes" and "No" checkboxes on a subform. The problem is that when I click the Yes checkbox on the subform, all of the
checkboxes are checked.

Currently, I have a field "Refused." It is defined as a text field. A
"Y" means that the service has been refused; an "N" indicates it has
been accepted. If the field is Null, the question has not been answered, i.e. we don't know if it has been refused or not.

I want the user to be able to check the Yes checkbox and have a Y
entered into the field, or check the No checkbox and have an N entered. This is not a problem. I have used an If statement on the Click events
of each checkbox.

Let's say that one of the boxes is checked in error. I want to be able
to uncheck it and set the field to Null.

I tried changing the field to Number and using an option group and
writing code in the OnClick event and the BeforeUpdate event, but to no avail. I figured if I could capture the field contents before the field was changed, I could get it to work but cannot figure out out to capture that data.

I know that I can have two fields "RefusedYes" and "RefusedNo" but that means using two fields when only one is really required and will cause
more work down the line when using the data in queries and in code.

Any ideas on how to do this and not have all the Yes or No checkboxes
checked?

Thank you,
Deborah



Nov 12 '05 #5
TC
The comment in question was referring to the option of making the per-row
unbound fields updatable.

Since you are clearly skeptical of the simplicity of having per-row unbound
values on a continuous form, let me spell it out - from memory!

1. Create bound subform.

2. Add an unbound textbox with recordsource:
=FieldValue()

3. Put this code in the form module:
private gValue() as variant
private sub form_open (cancel as integer)
' do anything to redim gValue() from zero to
' me.recordsetclone.absoluteposition, and
' put a value in each element.
end sub
private function FieldValue() as variant
with me.recordsetclone
.bookmark = me.bookmark
FieldValue = gValue (.absoluteposition)
end with
end sub

A dozen lines of code. I say this is perfectly simple. Your milage may vary!

TC
"Larry Linson" <bo*****@localhost.not> wrote in message
news:wa****************@nwrddc02.gnilink.net...
<CHUCKLE> If it were "even near simple", wouldn't you have found it
worthwhile to remember the details to do it, as you caution you didn't?
"TC" <a@b.c.d> wrote in message news:1074567506.874946@teuthos...

"Larry Linson" <bo*****@localhost.not> wrote in message
news:sa***************@nwrddc02.gnilink.net...
That is the way unbound controls work in continuous forms view, which I assume is the form of display in your subform. There's just not a
workaround, not an even near simple one, at least.


Sure there is! You can easily display distinct (per-row) values in an
unbound control on a continuous form. It takes a dozen lines of code (if
that). You can even make them updatable! That's more difficult, but still
quite do-able. See the following google message ID:

< 1067659397.218969 @ teuthos > (remove the four spaces)

TC


Bind the checkbox to a Yes/No field and it'll work as you desire. If
necessary, put the Yes/No field in a different table and join the two

tables
in the Query that you use for RecordSource.

Larry Linson
Microsoft Access MVP
"Deborah V. Gardner" <dg******@twcny.rr.com> wrote in message
news:40**************@twcny.rr.com...
> I would like to use "Yes" and "No" checkboxes on a subform. The

problem > is that when I click the Yes checkbox on the subform, all of the
> checkboxes are checked.
>
> Currently, I have a field "Refused." It is defined as a text field. A > "Y" means that the service has been refused; an "N" indicates it has
> been accepted. If the field is Null, the question has not been answered, > i.e. we don't know if it has been refused or not.
>
> I want the user to be able to check the Yes checkbox and have a Y
> entered into the field, or check the No checkbox and have an N entered. > This is not a problem. I have used an If statement on the Click events > of each checkbox.
>
> Let's say that one of the boxes is checked in error. I want to be able > to uncheck it and set the field to Null.
>
> I tried changing the field to Number and using an option group and
> writing code in the OnClick event and the BeforeUpdate event, but to no > avail. I figured if I could capture the field contents before the field > was changed, I could get it to work but cannot figure out out to capture > that data.
>
> I know that I can have two fields "RefusedYes" and "RefusedNo" but that > means using two fields when only one is really required and will cause > more work down the line when using the data in queries and in code.
>
> Any ideas on how to do this and not have all the Yes or No checkboxes > checked?
>
> Thank you,
> Deborah
>



Nov 12 '05 #6

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

Similar topics

1
by: John Mudd | last post by:
I come from the Access environment where all the windows form handles were hidden so pardon my question. In Access I could make "continuous" subforms and there was a subform "container" object I...
3
by: Evil | last post by:
Hi, i have a problem with a treeview and some subforms in MS Access97. I have a form with a treeview on the left side which lets me navigate thru some projects. Then on the right side, i have...
0
by: Arnold | last post by:
Hi there, I have a form to organize bottles in mind, but am unsure if it will work. Here's some background info: Mainform = frmProduct, which contains fields for pricing, status, etc. of...
0
by: CSDunn | last post by:
Hello, In Access ADP's that connect to SQL Server databases, any time I have a situation where I have a combo box in a main form that looks up a record in a subform, the subform record source has...
2
by: Steve B | last post by:
I am trying to design a Call Log Detail form that will allow users, in a multi-user environment, to select various data/records, not necessarily in sequential order, from a subform that will, when...
5
by: Richard Stanton | last post by:
Hello all My database has a main form linked to table1. It has several subforms on the main form, all linked to table2. Table1 and Table2 are linked by primary/foreign key, no duplicates...
2
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the...
3
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
0
by: AccessAl | last post by:
hi: Is there a limit the to the number of subforms and pages that can be used on any one form? On several systems that I use, we have 5 to 7 pages( or tabs). We use subforms on those pages. ...
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...
0
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.