Solved Conditional formatting record Edit (1 Viewer)

smtazulislam

Member
Local time
Today, 22:16
Joined
Mar 27, 2020
Messages
806
I have use conditional formatting for criteria that, if cboStatus= Transfer then Visible false.
Its all working well, You can see attached image.

Now I want to add EDIT Button to edit record data.
Capture.PNG
I put cmdEdit button code:
Code:
 Private Sub cmdEdit_Click()
Me.cboStatus.Locked = True
End Sub
Its unlocked, but recored data and combo box dont shark and can't edit anything.
Any help...
 

bastanu

AWF VIP
Local time
Today, 12:16
Joined
Apr 13, 2010
Messages
1,402
Can you show us the conditional formatting expression(s)? The code you show us LOCKS the combo, you need to set the .Locked=False to unlock it.
Where\how do you lock the record (as conditional formatting will not do that)?

Cheers,
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 15:16
Joined
May 21, 2018
Messages
8,519
I do not think I understand what you are saying, I do not see anything set to visible = false.
Do you mean in conditional formatting that you disable fields if cboStatus = transfer? Those looks possibly disabled.. If that is the case then...

If you would like to enable the disabled row, then I think you have to set that cboStatus to something like Null, and then probably a repaint to force the conditional formatting to update. If doing this in conditional formatting, you cannot override it.

me.cboStatus = Null
me.repaint
 

smtazulislam

Member
Local time
Today, 22:16
Joined
Mar 27, 2020
Messages
806
Can you show us the conditional formatting expression(s)? The code you show us LOCKS the combo, you need to set the .Locked=False to unlock it.
Where\how do you lock the record (as conditional formatting will not do that)?

Cheers,
thank you so much.

Yes, my expression is [cboStatus]="Transfer"
then row will be lock (any Disable) .
But I want to edit previous row which already locked.
 
Last edited:

smtazulislam

Member
Local time
Today, 22:16
Joined
Mar 27, 2020
Messages
806
Do you mean in conditional formatting that you disable fields if cboStatus = transfer? Those looks possibly disabled.. If that is the case then...
Yes, disable fields.
But some time we need to edit.
so that, I like to add a Edit button to correction data.
How can possible to enable those fields ?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:16
Joined
May 7, 2009
Messages
19,227
Code:
 Private Sub cmdEdit_Click()
Me.cboStatus.Locked = (Me.cboStatus & "" = "Transfer")
End Sub
 

smtazulislam

Member
Local time
Today, 22:16
Joined
Mar 27, 2020
Messages
806
Code:
 Private Sub cmdEdit_Click()
Me.cboStatus.Locked = (Me.cboStatus & "" = "Transfer")
End Sub
Thank you so much.
its field is Enable, but combo box not shark. I can't edit.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:16
Joined
May 7, 2009
Messages
19,227
then, you just remove the code from cmdEdit button entirely.
then change you Conditional format to Only change the Font Color and Background Color and
and not use the Enable button.
 

smtazulislam

Member
Local time
Today, 22:16
Joined
Mar 27, 2020
Messages
806
then, you just remove the code from cmdEdit button entirely.
then change you Conditional format to Only change the Font Color and Background Color and
and not use the Enable button.
If dont lock those rows, user member any time edit data easily.

Have any others ways to lock and Unlock
Or Disable and Enable when needed.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:16
Joined
May 7, 2009
Messages
19,227
see this demo database.
the Format Condition is based on txtHidden (see the Format Condition).
see also the Load / AfterUpdate event of the form
that manipulate txtHidden textbox.
 

Attachments

  • CF_AllowEdit.accdb
    512 KB · Views: 241

smtazulislam

Member
Local time
Today, 22:16
Joined
Mar 27, 2020
Messages
806
see this demo database.
the Format Condition is based on txtHidden (see the Format Condition).
see also the Load / AfterUpdate event of the form
that manipulate txtHidden textbox.
omg !
I dont thinking that my edit buttom take your lots of times. Lots of code you are created for me. Really I appreciated for that.
Than you somuch Mr. @arnelgp.
You are genius man.
 

Users who are viewing this thread

Top Bottom