How to make records of continuous subform show different properties

M

MariahJ

I have a form with a continuous subform. On the subform, there are two
checkboxes. If Checkbox 1 is selected, Checkbox 2 must be selected as
well. Therefore, I would like to disable Checkbox 2 only when Checkbox
1 is selected. When I tried doing this, of course the result was to
disable or enable every checkbox each time a change was made. I tried
playing with the form's On Current event but didn't get anywhere.

By searching this forum, I found that there doesn't seem to be any way
to do this with a continuous form. However, I'm wondering if there is
some way to creatively "fake it". Any suggestions would be greatly
appreciated.
 
A

Albert D. Kallal

Actually, it not really a problem!!

I certainly have a lot of continues forms where I set the controls 'enabled'
property on/off. While this actually makes all instances of the control go
disabled, I actually find this works quite well. I mean, when you move
to the next row, those columns that you enable, or disable can then
be set. So, you could set the controls visible property as you move
the cursor up/down through the

In fact, I actually PREFER the above behaviour, as then during
data entry it is VERY easy to see that the column in question
is enabled.

In place of a VERY HARD TO READ checkerboard pattern of enabled, and
disabled boxes, you get a very nice enable/display view as I move the cursor
up /down.

I have uploaded a gif animation of me navigating in a form, both of the two
screen shots will give you an idea of how this looks.

http://www.members.shaw.ca/AlbertKallal/HideColumn/index.htm

At a look at those forms, and you can see in both examples that cursor
movement hides/enables columns, and it acutely looks just fine..and in fact
I would argue better....
 
G

Guest

Hi MariaJ,
If the CheckBox1 and CheckBox2 are unbound (i.e. they are not linked to
actual "true/false" fields in a table in the database) then check marking one
of them in the continuous form, will cause all the check boxes on the form to
appear checked and viceversa.

If this is your case, try adding two "True/False" fields to a relevant table
in your database and set the fields as the source data for the check boxes in
your continuous form. When you do that, each record in the continuous form
will show the status of CheckBox1 and CheckBox2 independently from all the
other records on the form.

I hope this helps.
 
S

Steve Schapel

Mariah,

Whereas I agree that Albert's examples look quite acceptable, I
personally would prefer the enabled/disabled to show as applicable for
each record, as I thing that is less confusing. So it looks like it's a
case of personal preference :)

Of course, this would be easily achieved in Albert's example, using
Conditional Formatting. However, as you apparently realise, Conditional
Formatting only applies to textboxes and comboboxes, so your problem
really relates to the fact that you are using checkboxes, so can't be
done with CF. So, if you could make a textbox to look and behave like a
checkbox, then the Conditional Formatting solution would work fine.
Well, the answer is that this is possible. It's actually not all that
hard, but it does involve writing some code to toggle the value of a
hidden control on the Click event of the pseudo-checkbox, and so forth.
And using a font like WingDings that includes a "tick" character. So
why don't you give that a go. It might involve a bit of fiddling around
to get it looking good, but should be worth the effort. Let us know.
 
G

Guest

I may be wrong but it seems to me that Albert's example works nicely only
because the checkboxes (Invoice) are bound to the underlying record.
Depending on the status of the check box, the particular record then appears
enabled or disabled when a "Form_Current" event is triggered.
If the "Invoice" CheckBoxes were unbound, then clicking on any one of them
on the subform, would make all other checkboxes with the same name appear to
have the same status.

Back to Mariah, I would guess that the intent is that each record on the
subform is supposed to represent individual data, each with its own specific
checkbox status.
If this is the case, then the subform's underlying table/query should have
corresponding Yes/No fields linked to the two check boxes on the subform and
that would allow each checkbox to assume its own status individually in each
record.

If for some reason the check boxes must be just free floating and cannot
have an underlying field, then I think that your suggestion is probably the
most practical.

Regards
Gino
 
A

Albert D. Kallal

If the "Invoice" CheckBoxes were unbound, then clicking on any one of them
on the subform, would make all other checkboxes with the same name appear
to
have the same status.

Well, you can have a check box UN-bound to a field, but bind it to a
function, and this works well.

I have a mutli-select example that lets you check, and un-check boxes on a
continues form, but the check boxes are NOT bound to a field....

You can find this example here:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
 
G

Guest

Thank you Albert for your comment and the example.
Yours is an interesting approach which works particularly well if no
persistent indicator in the database is required, (such as selecting records
to print like in your example).
I learn something new every day...!

I generally add a "Selected" Yes/No field to most of my tables because I
find that in practice it comes very useful to select, print/reprint, purge or
otherwise isolate the specific records I need.
I find also that, in practice, typical database boolean fields like "Job
Completed" or "Payment Received" or other indicators check boxes, have to be
persistent.

However, I can see where your code would be very useful in situations where
users work out of the same tables on a backend database and each wants to
select specific records locally, without affecting the selection status of
other users.

Regards
Gino
 
S

Steve Schapel

Gino,
If for some reason the check boxes must be just free floating and cannot
have an underlying field, then I think that your suggestion is probably the
most practical.

Well, I wonder whether Mariah is still following this discussion :)

But I think the key point here, which I am not sure you have understood,
is that Mariah wants the checkbox to be *disabled* for specific records.
And my point is this... If she was talking about a textbox, this
could be done by using Access's built-in Conditional Formatting. But
this does not apply to checkboxes. But if she made a textbox whick
looked like a checkbox (this is quite easy), then she could use
Conditional Formatting. That's it.
 
G

Guest

Hi Steve,
thank you for your comment.
Enabling/disabling a check box based on the status of another checkbox on a
form is actually pretty simple (the Current event on the form could take care
of that, if the checkboxes have persistent values, i.e. they are bound to
fields).

The issue I was addressing was what I thought was actually the other big
problem for Mariah, i.e. the fact that marking a single check box on the
continuous form, was changing the status of all the check boxes with the same
name, (most likely because the check boxes are not bound), thus generating a
very confusing situation.
Regards
Gino
 
S

Steve Schapel

Gino,
Enabling/disabling a check box based on the status of another checkbox on a
form is actually pretty simple (the Current event on the form could take care
of that, if the checkboxes have persistent values, i.e. they are bound to
fields).

This is simply not true. If you use code like this to enable/disable
the checkbox, it will be enabled/disabled for all records on the
continuous form. This is not the behaviour that Mariah was seeking.
She wanted it enabled for some records and not for others, based on the
value of another field in that record. Your idea will *not* work for this.
 
G

Guest

Hi Steve,
if the issue is just the appearance of the checkbox then you are right. The
apperarance will change for all the checkboxes.

If the issue and functionality required is instead the ability to
disable/enable or lock/unlock a checkbox on a record on a continuous subform,
(based on the status of another check box in the same record And
independently from all other records on the same continuous subform) then a
simple form_current event on the subform, like the one below, does that very
nicely.
Regards
Gino

Code on subform....
clears and disables the chkInvoicePaid box unless the chkInvoiceSent box is
checked.
-------------------------------------------------------------
Private Sub Form_Current()
If Me.chkInvoiceSent = False Then
Me.chkInvoicePaid = False
Me.chkInvoicePaid.Enabled = False
Else
Me.chkInvoicePaid.Enabled = True
End If
End Sub
------------------------
Private Sub chkInvoiceSent_AfterUpdate()
Me.Recalc
End Sub
------------------------
Private Sub chkInvoicePaid_AfterUpdate()
Me.Recalc
End Sub


____________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top