Continuous form conditional formating control one vs control two

Experts,
My continuous form has a bound check box control OnTimeScrap where the default is False.
I also have a text box txtOnTimeScrap. This control is bound the OnTimeScrap.
I understand that I can not make a bound control invisible in a continuous form.  Therefore, I would like to enable/disable my control through conditional formatting. I've tried but I can not get it to work.
Here's my objective. If Me.OnTimeScrap = -1 then I want to disable this control.
Frank FreeseAsked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
*typically* ... a check box or a text box would be enabled/disabled based on the state of another control (that has a Control Source) or an expression based on another control(s), etc.

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
ok

Apply CF to the txtOnTimeScrap text box as follows:

Condition1:         <expression>                  
Expression Is    [OnTimeScrap]=True       Click the last tool bar past Fore Color - which is the Enable/Disable

You could also change the Backcolor to indicated it was disabled if you wish.

mx
0
 
Frank FreeseAuthor Commented:
Here's what I did:
I selected the control txtOnTimeScrap
Condition 1:
Expression Is Me.OnTimeScrap=True
Selected Enabled/Disabled
The results was that the txtControl was disabled, however, the bound control OnTimeScrap continues to work.
What I do not want the user to do is to change from check to uncheck but they can change uncheck to checked, the bound control OnTimeCheck.
I remember you telling me that a check box can not have CF so we moved to another control to disable the check box.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Expression Is Me.OnTimeScrap=True

You can't use 'Me' in this expression, only in VBA code.

You need this:

[OnTimeScrap]=True  

mx
0
 
Frank FreeseAuthor Commented:
I must be missing something here MX. I changed the expression as suggested but it still does not act on the bound check box control OnTimeScrap. It does work on the text control txtOnTimeScrap. I've tried this with  txtOnTimeScrap control source = OnTimeScrap as well as nothing in the txtOnTimeScrap control source.
Excuse my redundancy. My continuous form has two controls. OnTimeScrap is bound to control source OnTimeScrap and is a check box control visible is Yes and Enabled is Yes.
My second control is txtOnTimeScrap and is unbound. It is visible and Enabled is Yes.
My CF is on txtOnTimeScrap with only 1 condition
Expression Is [OnTimeScrap]=True  and Disabled.
Thanks for hanging in there with me.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
ok ...

Can you Compact & Repair (to shrink the size), then zip up the MDB, then attach the file for upload here (using the 'Attach File function below) ... removing any sensitive data of course? And please give a clear explanation of exactly how to reproduce the problem.

mx
0
 
Frank FreeseAuthor Commented:
Open the form Comments.
0
 
Frank FreeseAuthor Commented:
do you see the zip file? I went to attach file, add file. it went through uploading but i should have been ask to give it some title.
0
 
Frank FreeseAuthor Commented:
This time I got the description for cf.zip. Open the form comments.
CF.zip
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
ok ... I have the mdb ... will check out shortly.

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
ok ... still a bit confused.

"The second control is OnTimeScrap. This control is what I've been wanting to disable. "
Based on what condition ?  You say:

"Again, the objective is that if OnTimeScrap is True then I do not want to disable the check box. Right now the users do all this manually and it takes a lot of time. "

You're saying the if the Check box is True - don't disable it ?  Otherwise disable it ?

Then what is the purpose of txtOnTimeScrap ? The CF in that control isn't really doing anything ...

Soo ??

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Based on what you are saying, the only way I can see this happening is if you do this in the Form On Current event:

Private Sub Form_Current()
    If Me.chkOnTimeScrap = True Then
        Me.chkOnTimeScrap.Enabled = True
    Else
        Me.chkOnTimeScrap.Enabled = False
    End If
End Sub

Note that I renamed the check box - to be different than the Control Source - so the name is chkOnTimeScrap

mx
0
 
Frank FreeseAuthor Commented:
I thought of that also earlier and did try your code. I caused all of the chkOnTimeScrap to be disabled if false. It appears that the cf only applies to the control it is working on and not another control. You worked hard on this and deserve the credit. Whats the best way to close this with credit?
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"I caused all of the chkOnTimeScrap to be disabled if false."

Well ... yes, depending on the check boxes state when you click into a row, they will all assume the same state based on the condition - not the ideal solution. Maybe there is another way.  Possibly I don't completely understand what is needed here ?

mx
0
 
Frank FreeseAuthor Commented:
thanks for staying with me.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.