Check box problem is not solved

  • Thread starter Thread starter Kaushik
  • Start date Start date
K

Kaushik

Hi Everyone,

Say I have 100 records that are coming from the record source query.
Each of these records have fields named "ObjNumber" and
"RCSub1". "RCSub1" is a boolean field and it's value gets reflected in
"RCCheck1" check box. As I have 100 records so 100 "RCCheck1" check boxes
will generate. Now I have to see each "ObjNumber" field and if the value of
any record in those 100 records is "16" then the corresponding CheckBox will
be disabled.

I tried with forms_Current event but problem is that this event is
encountered only once in time of opening and only if it finds the first
record to be "16" then it is making all the checkboxes disabled. But I have
to check each record and depending on their value I have to enable or disable
the check box.

I tried your solution but current event not at all generating any new
record so at the time of opening the If loop is encountered and the control
flow is getting out.

Also the current event of the form is fired only once in time of opening,
how come I can check for "ObjNumber" field for 100 records there.

Please Let me know If You have any solutions

Thanks and Regards
Kaushik
 
Hi,
Yes this is the way Access works on a continuous form. This is normal
behaviour for Access.
If you post back with a description of what you are trying to achieve by
disabling certain check boxes, we might be able to suggest another way to
get the result you want.

Jeanette Cunningham
 
Hi,

The requirement is very simple as described in my post.User are not
permitted to check or uncheck the checkboxes if the objnumber value is "16".

Thanks and Regards
Kaushik
 
Hi,
using the locked property of the checkbox will give what you want.
A user can't change the value of a locked check box.

Like this:

Private Sub Form_Current()
If Me.ObjNumber = 16 Then
Me.RCSub1.Locked = True
Else
Me.RCSub1.Locked = False
End If
End Sub

Jeanette Cunningham
 
Kaushik said:
Say I have 100 records that are coming from the record source query.
Each of these records have fields named "ObjNumber" and
"RCSub1". "RCSub1" is a boolean field and it's value gets reflected in
"RCCheck1" check box. As I have 100 records so 100 "RCCheck1" check boxes
will generate. Now I have to see each "ObjNumber" field and if the value of
any record in those 100 records is "16" then the corresponding CheckBox will
be disabled.


Use a small, sunken text box to simulate the check box. Set
the Format property to ;"X";"";""

Use a little code in the Click event to toggle the value:
Me.thetextbox = Not (Nz(Me.thetextbox, 0) <> 0)

If you are enamored with the check mark, then set the Font
to Wingdings and replace the X with the code for the check
mark. Either way, you will probably want to adjust the
FontSize.

Then you can use Conditional Formatting (Format menu) to
disable the text box.
 
The requirement is very simple as described in my post.User are not
permitted to check or uncheck the checkboxes if the objnumber value is "16".

Open the Form in design view, and select the checkbox.

Use Format... Conditional Formatting.

Use an Expression

[objnumber] = 16

(or "16" if objnumber is a text field).

Select the "disabled" choice in the formatting.


If you don't have A2002 or later (which is, I think, where conditional
formatting came in), use the BeforeUpdate event of the checkbox; set Cancel to
True if objnumber is 16.

One question: what's to keep someone from changing the objnumber, checking the
checkbox, and changing the objnumber back to 16? You may need to check this
condition in the Form's BeforeUpdate event as well.

John W. Vinson [MVP]
 
Actually, Conditional Formatting isn't available for Checkboxes and Radio
Buttons in Design View; I'm not sure whether or not it can be done in VBA.

BTW, Conditional Formatting came along with ACC2000.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Linq Adams via AccessMonster.com said:
Actually, Conditional Formatting isn't available for Checkboxes and ...

I think you missed the point of Marshall's post:
Use a small, sunken text box to simulate the check box

Here's an example of what he is talking about:
Format check boxes in reports
at:
http://allenbrowne.com/ser-52.html
 
Actually, Conditional Formatting isn't available for Checkboxes and Radio
Buttons in Design View

<blush> Quite right, I'd forgotten that (and that was my suggestion). The
textbox trick will work though.

John W. Vinson [MVP]
 
Back
Top