Results 1 to 4 of 4
  1. #1
    Secue is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    33

    Question Default values just as reference on a form

    Hi:



    I want to know if there is any way to place on a form some reference on the available fields, for example If I have a field "Name", place on gray inside of the text box "Please enter your name here" but once I select the box, this reference is deleted and I can enter the information. Is like a reference for the users to know what information must be entered on the text box.

    Thank you.,

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Sure, but it takes some doing, and can only be done on a Single View Form (not on a Datasheet or Continuous View Form):

    • Delete the Textbox’s attached Label
    • Create new Label for Textbox with the Caption of choice
    • Set BackStyle and BorderStyle of the Label to Transparent
    • Position Label inside of the Textbox

    Now, use this code, replacing TargetFieldLabel and TargetField with the actual names of your Controls:

    Code:
    Private Sub Form_Current()
    
    If Nz(Me.TargetField, "") <> "" Then
      TargetFieldLabel.Visible = False
    Else
      TargetFieldLabel.Visible = True
    End If
    
    End Sub


    Code:
    Private Sub TargetField_GotFocus()
     
      TargetFieldLabel.Visible = False
    
    End Sub


    Code:
    Private Sub TargetFieldLabel_Click()
    
      TargetField.SetFocus
    
    End Sub


    Code:
    Private Sub TargetField_LostFocus()
    
    If Nz(Me.TargetField, "") <> "" Then
      TargetFieldLabel.Visible = False
    Else
      TargetFieldLabel.Visible = True
    End If
    
    End Sub


    Linq ;0)>

  3. #3
    Secue is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    33
    Thank you. This solved my problema.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Linq ;0)>

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

Similar Threads

  1. default values in a form
    By kmims44 in forum Forms
    Replies: 9
    Last Post: 06-28-2012, 12:35 PM
  2. Default Values In Form
    By ASW in forum Programming
    Replies: 2
    Last Post: 01-18-2012, 08:55 AM
  3. Default Min & Max Date Values in Form
    By alsoto in forum Forms
    Replies: 3
    Last Post: 10-03-2011, 10:54 AM
  4. Default Values in a form
    By handjor in forum Forms
    Replies: 3
    Last Post: 08-03-2011, 09:11 AM
  5. Default Values
    By twainscott in forum Programming
    Replies: 0
    Last Post: 09-14-2006, 11:18 AM

Tags for this Thread

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