Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the Default Value of a text box

Status
Not open for further replies.

jaaret

Instructor
Jun 19, 2002
171
This seems like it should be easy but I haven't been able to get it to work. I want to preserve the value typed into an unbound text box on a form so tht whatever value was entered when the form was last used will display the next time the form is opened.

The unbound text box is txtAreaProfiled.

Thanks for educating me,
Jaaret
 
Only bound controls maintain there values when a form is closed then opened again. The textbox will have to be stored in as table for this to work. If you have a date/time stamp on a record, you can retrieve the last value stored in a given field.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
If you mean that Access is shut down then opened at a later date, you'll have to store the data in a table. So make the textbox bound to a field.
If you mean with a session of the Database, you can create a global variable and store the data there. Go to VBA (ALT + F11). Click Insert - Module. You'll see on the left General and Declarations. Type in :
Public VariableName As Whatever
Then in the, let's say, AfterUpdate of the textbox put:
VariableName = Me![txtAreaProfiled].Value
This will allow you to use the variable throughout the application.
 
How are ya jaaret . . .

Might I introduce you to [blue]Custom Db Properties![/blue] These properties are non-volatile and stay with the Db (frontend if the Db is split). Close and open the Db and the property you setup is still there.

See setup here: thread702-1236022

Note: if the Db is to reside on a network then the table mentioned by [blue]missinglinq[/blue] is the way to go!

[blue]Your Thoughts . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top