Results 1 to 12 of 12
  1. #1
    deepaksharma is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Jul 2023
    Location
    india
    Posts
    389

    How to design Text box for showing temporarily text


    I have designed a login page which has two text boxes, one for userid and the other for password. I want the user ID and password text to temporarily appear in light color in the text boxes as per the attached image, until the user clicks on these text boxes.
    How do I design a text box for this?
    Thank you.
    Attached Thumbnails Attached Thumbnails SEND USER.png  

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Perhaps set its Default property
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    You set the background as you want in design mode and then OnFocus or OnEnter you change the values.?
    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

  4. #4
    deepaksharma is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Jul 2023
    Location
    india
    Posts
    389
    Thanks to both of you, I first put the default value user name and password in both the text boxes and after that i controlled them with got focous and lost focus.
    Thank you both.

  5. #5
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    You could also use the format property.
    Click image for larger version. 

Name:	UserID.JPG 
Views:	22 
Size:	14.9 KB 
ID:	51048
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  6. #6
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Quote Originally Posted by moke123 View Post
    You could also use the format property.
    Click image for larger version. 

Name:	UserID.JPG 
Views:	22 
Size:	14.9 KB 
ID:	51048
    It would be really useful if you could specify a larger range of colours or other properties in that format property, especially on continuous forms.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Code:
    @;[Cyan]"UserID"
    @;[Blue]"UserID"
    @;[red]"UserID"
    @;[green]"UserID"
    @;[yellow]"UserID"
    How many colors do you need?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  8. #8
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    You're allowed 8 basic colours and grey is not one of them, correct?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Quote Originally Posted by Micron View Post
    You're allowed 8 basic colours and grey is not one of them, correct?
    Correct, I mean I'm being picky here, but grey isn't an option, and you can't alter the font size or type.

    I'm sure the Access bods will pick this up and fix it before they sort out the new SQL editor
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Ha! That gives them plenty of time!

    There are ways around this depending on what you are trying to do. For example, see Colour Conditions (isladogs.co.uk)
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #11
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Click image for larger version. 

Name:	ztbox.JPG 
Views:	13 
Size:	9.1 KB 
ID:	51055

    Click image for larger version. 

Name:	ztbx2.JPG 
Views:	13 
Size:	9.1 KB 
ID:	51056
    Seems to work ok.

    Code:
    Private Sub Form_Load()
        Me.Text2.ForeColor = RGB(203, 203, 203)
    End Sub
    
    
    Private Sub Text2_Change()
        Me.Text2.ForeColor = vbBlack
    End Sub
    
    
    Private Sub Text2_Exit(Cancel As Integer)
        If Nz(Me.Text2, "") = "" Then
            Me.Text2.ForeColor = RGB(203, 203, 203)
        End If
    End Sub
    Conditional formatting also works.

    Click image for larger version. 

Name:	zfor.JPG 
Views:	13 
Size:	24.4 KB 
ID:	51057
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  12. #12
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you missed

    Black, White, Magenta

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 08-30-2019, 12:02 PM
  2. Replies: 1
    Last Post: 05-18-2016, 09:46 AM
  3. Table now showing id instead of text
    By spoolinaz in forum Access
    Replies: 5
    Last Post: 01-02-2014, 11:51 AM
  4. Text box showing #name?
    By redbull in forum Forms
    Replies: 7
    Last Post: 06-21-2013, 01:29 PM
  5. #Name? error showing in Text box.
    By yes sir in forum Access
    Replies: 2
    Last Post: 09-21-2010, 02:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums