Consulting

Results 1 to 8 of 8

Thread: change appearance tekstbox

  1. #1
    VBAX Regular
    Joined
    Jan 2016
    Posts
    35
    Location

    change appearance tekstbox

    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?

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    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.

  3. #3
    VBAX Regular
    Joined
    Jan 2016
    Posts
    35
    Location
    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.

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Can you provide a screenshot of what happens and what you want?

  5. #5
    VBAX Regular
    Joined
    Jan 2016
    Posts
    35
    Location
    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.

  6. #6
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    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.

  7. #7
    VBAX Regular
    Joined
    Jan 2016
    Posts
    35
    Location
    OBP,
    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.

  8. #8
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    You are welcome, you can make the Id field very small so that it hardly noticeable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •