Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Put default text into text box without it being stored in the table

Put default text into text box without it being stored in the table

Put default text into text box without it being stored in the table

This is probably easy for the wizards out there, but I'd like to have a value in a text box that says something like "Insert Name Here", preferably in grey, which wouldn't save the words "Insert Name Here" to the underlying table. It's like an information reminder for the user if the field is null.

I hope I explained myself clearly. Is there a way to accomplish that in Access?

As always, thanks in advance.

RE: Put default text into text box without it being stored in the table

Thank you so much! After playing with the suggestions I made a few modifications.

In the .Format property I inserted the @;”Enter Desired Hint” as your link suggested, but I wanted the hint in grey and default text in black so I made a few other changes.

I set the conditional formatting for the field to the expression IsNull([FieldName]), and set the text to grey under those conditions. Perfect! Almost...

The problem was as I started typing into the field, the conditional formatting didn't recognize the field as other than a null value until after update, so it worked fine, except that as I typed the characters were in grey, and after update they went to black. I didn't like it that way so I did something a little different.

In the OnEnter event I set the value of the field to " " and Refresh if the field value were null. Now that blank field has an invisible blank space in the field, and it's no longer seen as Null. All my typing is in black from that point forward. ALMOST PERFECT!

The last issue is that I didn't want to have the blank leading space saved in my table for search, etc., so on the AfterUpdate event I simply added a Trim([FieldName]). NOW the problem is solved and it works just like HTML. The Trim command also removes the blank space if I remove a value, resetting the field to Null, the text to grey, and causing the Hint Text to reappear!

I couldn't have done it without the help. I've been doing this a long time and still had never seen the Format of @: before.

I always appreciate the willingness of folks here to help others.

RE: Put default text into text box without it being stored in the table

I had to make one more minor tweak. If I clicked into the field and set the value to " ", and then for some reason didn't do any updating and just went to another field the " " would remain, and since the field was no longer null the Hint text didn't show.

Simple fix. On the OnExit event I used the Trim([FieldName]) command under the condition that the Len([FieldName])=1. That's all. If I try to abandon the field after entering it without an update it will correct itself and still display the Hint text!

RE: Put default text into text box without it being stored in the table

Great that you were able to modify the link to meet your needs and provide some examples of what you ended up with.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close