Results 1 to 13 of 13
  1. #1
    intrepid is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Posts
    24

    Default Text Value for empty Text Fields that disappear when clicked

    I want to display text in empty fields on a form to indicate what information to type in, within that field. After clicking on the field, I want the text to disappear and allow the user to fill in the field. Also, I want the place holder text to be italicized and grey.

    Attached is an example of what I've attempted.

    Any help would be very much appreciated



    Click image for larger version. 

Name:	default text value example to click.png 
Views:	25 
Size:	7.0 KB 
ID:	19827

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    IMO, this is more trouble than its worth. I just have labels.

    Could use DefaultValue property to display the clue. Code in GotFocus event could set the field to null if the field contains the clue. Use Conditional Formatting for the italic and grey setup.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    intrepid is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Posts
    24
    I'm sorry June, I have limited experience with coding. Could you give me an example code for the GotFocus event, along with the Conditional Formating?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Conditional Formatting is not something you code. This is form/report design and can be found on the ribbon Format tab. Access Help has more guidelines.

    Code could either set the field to Null or select the entire value so that as soon as user begins typing the value is replaced. Example:

    If Me.tbxTelephone = "Telephone" Then
    Me.tbxTelephone.SelStart = 0
    Me.tbxTelephone.SelLength = 9
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    intrepid is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Posts
    24
    You are right, this is absolutely more trouble than it's worth.

    So I've got the conditional formatting set as this;

    Code:
    Expression is: =IIf(IsNull([Main Contact Name]), "Contact Name" , [Name])
    And it reads that my syntax is wrong. What did I do wrong?

  6. #6
    intrepid is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Posts
    24
    I don't see an OnClick macro expression that will clear the Default Value !! And I'm still unclear as to how to format the Default Value as a different colour.


  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Intrepid,

    There are samples on youtube that may help. Here's one.

  8. #8
    intrepid is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Posts
    24
    Quote Originally Posted by orange View Post
    Intrepid,

    There are samples on youtube that may help. Here's one.
    Thanks orange, this is the same video available through Access Help - I've seen it.

    I think in sum, (haha), all I want to do now is change the Default Value text to a different font - so what is the expression and syntax, in Conditional Formatting, to specify the Default Value as the target for text formating?

    Basically, If [Default Value] then do the formatting.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I don't have 2013, and don't use conditional formatting a whole bunch.

    What exactly are you trying to do? Some context and details please.
    I'm not a macro user.

  10. #10
    intrepid is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Posts
    24
    Yep, so basically I have a subform for contact information for a list of organizations. When the contact information is blank, I want each of the fields in my contact list (Name, City, etc.) to display the default value, which has been set to describe each of the fields (Name, City, etc.). But, I want the default text to be formatted as a different colour than text that has been inputted or available through the Contact table.

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    My gut feeling is that your use of Default value is confusing readers (me at least).

    if you hve a list of fields that you want to have a default value or text that you can put on a form as a guide for users, then perhaps this might work.


    Create another table with the Field Names for the table, and associated text strings you want on the form.

    TblContactText
    ContactTextId PK
    ContactField
    AssociatedText

    with values such as

    1 ContactFirstName "Enter First Name of Contact"
    2 ContactLastName "Enter Last Name of Contact"
    5 ContactCity "Enter City for this Contact"

    If the control on the form is unbound, you could add these texts, and the user could overwrite with real data before creating a contact record from the inputted data. You could have the font color whatever you want, then change it when new Data is entered.

    Just thinking and typing.
    Last edited by orange; 03-01-2015 at 06:23 AM. Reason: spelling

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The Conditional Formatting would be a condition that changes the color if field value is "Contact Name". This is not an Expression Is rule. It is a Field Value Is Equal To rule.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    intrepid is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Posts
    24
    Quote Originally Posted by June7 View Post
    The Conditional Formatting would be a condition that changes the color if field value is "Contact Name". This is not an Expression Is rule. It is a Field Value Is Equal To rule.
    Bingo! I made it more complicated than I needed, thanks for sticking with me June7 on this. Such a simple solution - eh, my knowledge grows.

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

Similar Threads

  1. Replies: 8
    Last Post: 11-21-2014, 04:39 PM
  2. create default rich text in text box
    By enemydr in forum Forms
    Replies: 7
    Last Post: 02-19-2014, 09:38 PM
  3. Replies: 14
    Last Post: 01-16-2014, 09:38 PM
  4. Replies: 7
    Last Post: 10-28-2012, 02:55 PM
  5. Replies: 11
    Last Post: 10-06-2010, 12:19 AM

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