How can I show a text box struck-through. I used the Line Hide Show method but this does not work if I used the CAN GROW feature. Also, I could not find a Struck-through font. Is there any other way?
I am going to take a stab at this one, and say that it can not be done. In Word strikethrough is not a type of font but an "effect" on that font. The only thing you have available to a control are, Bold, Italic, Underline, Size, and Type of font.
I did not try it because I could not load the active X control, but you may want to try to use a Microsoft Rich Text Box control. You won't be able to bind the field, but if you can get it to strikethrough you can write the code to get the value in it.
Again, my computer is jacked up, but try using a Microsoft Forms Textbox. This will give you a standard VB textbox not an access textbox. I am pretty sure you can strikethrough using that.
Good question. I think it's one of those things that Access "just doesn't do". I believe the access equivalent would be Text.Enabled = False.
So here's a work-around if you really need it.
This should work with growing/shrinking textboxes, but you have to be able to add a bit of space on the existing textbox top margin.
Copy your textbox and paste it twice onto the form. Let's say T1 was your original and you now have added T1a and T1b. Delete any labels that are copied and pasted along with it.
1. Set the ForeColor of T1a to match the BackColor.
2. Set the BackStyle of T1 and T1a to Transparent.
3. Set the Top Margin of T1 to 0.05
4. Set the Bottom Margin of T1a & T1b to 0.05
5. Set the Font Underline of T1b to Yes
6. Set the Visible property of T1b to No
7. Send T1a to back
8. Send T1b to back
9. Set the Top and Left properties of T1a and T1b to the same values as T1.
You now have three text boxes stacked on top of each other. They all have the same recordsource but they all display it differently.
Since they have either the top margin or the bottom margin set to the same value, they will grow and shrink identically. The two new textboxes will display the text a little higher than the existing textbox, but you will never see that text. The middle textbox has its font set to match the backcolor and it covers the text in the bottom text box. The only thing it doesn't cover is the underline. That underline, shifted upward by the margins, becomes your strikethrough and matches the length of your text no matter what.
When you want the strikethrough effect, set the visible property of T1b to True with code.
I wish I had found a "real" way to do this, but I couldn't. If someone else does, it would be great to see it posted!
HTH
John
Use what you have,
Learn what you can,
Create what you need.
Drop a Microsoft Forms textbox control on your form. This code works fine. It is a bound control, works just like an access text box, and almost everyone should have the control class:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.