Hello. I'm wondering if I can use conditional formatting on a form when I'm looking for only partial text in a single unbound textbox.
I can do this with VBA but was wondering if it can be done via Conditional Formatting, in case I want to do it that way in the future or in other instances.
I've got an unbound textbox that shows a status and the date that status was set. The text is input into txtDocStatus via VBA code (look for the last status of a document and show it with the date. That information is not present anywhere on this particular form.
For this latter case I've tried a few options without success:
Thank you in advance.
I can do this with VBA but was wondering if it can be done via Conditional Formatting, in case I want to do it that way in the future or in other instances.
I've got an unbound textbox that shows a status and the date that status was set. The text is input into txtDocStatus via VBA code (look for the last status of a document and show it with the date. That information is not present anywhere on this particular form.
- If the status is Approved (e.g., Approved: 06-Dec-2023), the this is the base case and the textbox has the standard formatting.
- If the status is missing completely, the textbox value is No Status Found and I can use conditional formatting on the form to turn the box red. The Conditional Formatting Rules Manager rule is Value = "No Status Found" and this works as expected.
- If the status is Submitted, then the textbox value is that word and the date (e.g., Submitted: 05-Dec-2023). Obviously, I cannot hardcode a value into Conditional Formatting, because the date portion is variable.
For this latter case I've tried a few options without success:
- Value = Like "Submitted*"
- Expression is Instr(txtDocStatus,"Submitted")>0 <--gets changed to Expression is Instr("txtDocStatus","Submitted*")>0
- Expression is Instr(me.txtDocStatus, "Submitted") > 0
- Expression is Instr(Forms!frmDocuments!txtDocStatus, "Submitted") > 0
Thank you in advance.