Hi
Is it possible to make the background of a Control change Colour if the value is changed by the User?
Any help appreciated
Hi
Is it possible to make the background of a Control change Colour if the value is changed by the User?
Any help appreciated
You can PM me for help. Good Read https://docs.microsoft.com/en-gb/off...on-description
To attach file: https://www.accessforums.net/showthread.php?t=70301
Compare .Text with .Value?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Hi Welshgasman
How would I do this?
You can PM me for help. Good Read https://docs.microsoft.com/en-gb/off...on-description
To attach file: https://www.accessforums.net/showthread.php?t=70301
Just guessing, but just compare if not equal on exit of control?
You also have an .OldValue I believe?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Hi
So On exit of Control Compare .OldValue to ,CurrentValue
My VB Skills are minimal so how would the Syntax be for this?
You can PM me for help. Good Read https://docs.microsoft.com/en-gb/off...on-description
To attach file: https://www.accessforums.net/showthread.php?t=70301
Let's make sure the control is bound first? IIRC, an unbound control has no OldValue.
However if bound, when the form reloads the new value would still be there but whatever you did to highlight that will be gone.
And what does "changed" mean? Any alteration even when just typing? Or only if an edit has been saved? If the latter and you want it to be permanent you'll have to have an Updated field in the table, and this would only mean it was changed from an original saved value. If you change it 5 more times, it will only tell you that the fifth edit is not the original. Perhaps you'd be better off with a history table or field(s)?
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Come on Mike!,
You have over 300 posts here, over 13K in UA, and over 600 in AWF and you cannot write a simple IF statement?
You also have to take into account what Micron has mentioned plus resetting any controls when you change record.?
https://docs.microsoft.com/en-us/off...lse-statements
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Hi Welshgasman
You are right I do know how to write an If statement.
The only problem is I don't know how to apply an If statement to this process.
The Subform is a Continuous Form with all Controls Bound and all I want to happen is for just the 1 Control in a specific Record to change colour when the user changes the specific Controls value.
Is it possible?
You can PM me for help. Good Read https://docs.microsoft.com/en-gb/off...on-description
To attach file: https://www.accessforums.net/showthread.php?t=70301
I have not used continuous forms much, but I believe as long as the controls are bound, each record is treated individually, if not, then one change affects all the records.Hi Welshgasman
You are right I do know how to write an If statement.
The only problem is I don't know how to apply an If statement to this process.
The Subform is a Continuous Form with all Controls Bound and all I want to happen is for just the 1 Control in a specific Record to change colour when the user changes the specific Controls value.
Is it possible?
However there is no better way than trying it out?, it is hardly a lot of code?
Took me a few minutes, but I did the test on a main form control.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Hi
I tried the following in the ONChange Event of the Control:-
Me.PO_Part_DueDate.BackColor = vbRed
It works but it changes all of the Records not just the record selected?
You can PM me for help. Good Read https://docs.microsoft.com/en-gb/off...on-description
To attach file: https://www.accessforums.net/showthread.php?t=70301
There is only one of any type of control in the set of controls that are continuous. The rest of them are instances of the control. Change a design property of one and you do it to all. With cf forms, the only way to affect one and not another instance is conditional formatting.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Hi Micron
What would be the Expression to trigger the Background Colour Change on a specific Control?
Is it possible to use an If statement ? Something Like If [ControlName].Value Changes ?
You can PM me for help. Good Read https://docs.microsoft.com/en-gb/off...on-description
To attach file: https://www.accessforums.net/showthread.php?t=70301
Have never tried (that I can recall). Perhaps in the after update event of the control, something like
If Me.controlName.OldValue <> Me.controlName Then
use code to modify conditional format property
perhaps start with
https://docs.microsoft.com/en-us/arc...ccess-with-vba
or
https://docs.microsoft.com/en-us/off...rmatconditions
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Hi Micron
Tried the following in the AfterUpdate of the Control but nothing happens:-
Code:Private Sub PO_Part_DueDate_AfterUpdate() 10 On Error GoTo PO_Part_DueDate_AfterUpdate_Error 20 If Me.PO_Part_DueDate <> Me.PO_Part_DueDate Then 30 Me.PO_Part_DueDate.BackColor = vbRed 40 End If 50 On Error GoTo 0 60 Exit Sub PO_Part_DueDate_AfterUpdate_Error: 70 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure PO_Part_DueDate_AfterUpdate, line " & Erl & "." End Sub
You can PM me for help. Good Read https://docs.microsoft.com/en-gb/off...on-description
To attach file: https://www.accessforums.net/showthread.php?t=70301
Of course nothing happens.
The If line will never be true so the following line (30) is never run.
Try reading Micron's post again. That at least has a chance of working!