PDA

View Full Version : [SOLVED:] change appearance tekstbox



TonC
09-17-2018, 01:55 AM
Hello,:(

On my form I have a label. And when I click on this label, opens a form, and within that form is a textfield. But when the form is opened, the text is White and the background of the text is black. I would like to have the text Black and the background of the text white, or light-grey.

How to do so?

OBP
09-17-2018, 06:35 AM
With the Form in design mode click on the Text Box.
Click on the Format tab in the Property Sheet, scroll down to Back Color, it should be #FFFFFF for a white background.
Scroll further down to Fore Color and it should be #000000 for a black Font.

TonC
09-17-2018, 07:58 AM
Okay, this I knew. I think I've asked the wrong question. When I click on the label in the firstform, the second form opens, I see that the text in the textfield is marked.
The marked text, are white letters, with a black background. It seems like I selected the text with my mouse, but I did not do anything in the textfield. All I want is when the form opens,
the textfield has black letters, and a white or light-grey background. Only when I click in the textfield the markes goes away, then the appearance of the textfield is good.
So is there a piece of VBA code that allow me an automatic click in the textfield. Or an another solution? Sorry for my english.

OBP
09-17-2018, 09:09 AM
Can you provide a screenshot of what happens and what you want?

TonC
09-17-2018, 09:34 AM
I tried to upload a screenshot, but it did not work. Like I said, just a form, and within that form a textfield. And what I want is, when the form opens, the textfield is not marked.
Just plain black letters and a white or lightgrey background.

OBP
09-17-2018, 12:09 PM
Presumably the text box is being changed because it has "Focus", if you move to another field or object does that get it the way that you want it?
If so you can use VBA to set the Focus elsewhere.

TonC
09-17-2018, 01:35 PM
OBP,:thumb
Problem solved. In the form that was opened, the textfield had a link in mytable, named Id. By subprocedure formOpen I put the following VBA code:


Private Sub Form_Open(Cancel As Integer)

Me.Id.SetFocus

End Sub

And it worked. The appearance of the form is exactly how I wanted. The only obstakel is that I put my Id in the Textfield. But that's okay. When I tried to hide the Id the code did not work. So my solution was to show the Id in the textfield.

Thx for giving me help.

OBP
09-17-2018, 01:53 PM
You are welcome, you can make the Id field very small so that it hardly noticeable.