473,414 Members | 1,577 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,414 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 10056
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
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...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.