Make unbound (txtBox) remember its last value

G

Guest

Hello,
I have an unbound text box on my form, every time I enter a number
(currency) it stays there while the form is opened. When I close and open the
Form, the txtBox’s value is gone (loses the last/previous numbers the were
entered in it).
I do not want to set a default value numbers coze I change it once every week.
My question is how to make this unbound (txtBox) remember its value?

Thank you all,
Adnan
 
R

Rick B

Set the default using code tied to the afterupdate event. Then, every time
you change the entry, it will write your entry to the default.
 
G

Guest

Rick,
That was close, I wrote this code on after update:

Private Sub txtRateChange_AfterUpdate()
Me.txtRateChange.DefaultValue = Me.txtRateChange
DoCmd.Save
Me.Profession.SetFocus
End Sub

This will still not save the value, when I close the form the value is gone
(emptied).
What would you prefer adding/removing?

Thank you,
Adnan

--
Please post all your inquiries on this community so we can all benefit -
Thank you!


Rick B said:
Set the default using code tied to the afterupdate event. Then, every time
you change the entry, it will write your entry to the default.
 
R

Rick B

There are many posts related to this topic in the formscoding newsgroup. Go
take a look at these. Most include sample of the code...

http://groups.google.com/groups/search?hl=en&q=set+default+after+update

--
Rick B



Adnan said:
Rick,
That was close, I wrote this code on after update:

Private Sub txtRateChange_AfterUpdate()
Me.txtRateChange.DefaultValue = Me.txtRateChange
DoCmd.Save
Me.Profession.SetFocus
End Sub

This will still not save the value, when I close the form the value is
gone
(emptied).
What would you prefer adding/removing?

Thank you,
Adnan
 
R

Rick B

I think the post that you are looking for is the second one in the list. It
says...

----------------------------------------------------------------------------
Barbara
Add the following to the Combo's AfterUpdate event;
Me.comboName.DefaultValue = Chr(34) & Me.ComboName & Chr(34)
HTH
Andy
----------------------------------------------------------------------------


Adnan said:
Rick,
That was close, I wrote this code on after update:

Private Sub txtRateChange_AfterUpdate()
Me.txtRateChange.DefaultValue = Me.txtRateChange
DoCmd.Save
Me.Profession.SetFocus
End Sub

This will still not save the value, when I close the form the value is
gone
(emptied).
What would you prefer adding/removing?

Thank you,
Adnan
 
G

Guest

Anyone any help on this please?

How would the text get saved on a text box (unbound) when the form
opens/closes it still remains the same (do not want tables to get involved on
this please)

Any thought/tip/help is greatly appreciated!
v/r
Adnan
 
G

Guest

As far as I know it can't be done. I tried it with the unbound textbox, I
tried using it to change the caption on a label--none of those changes are
saved when the form is closed. I'm thinking you'll have to add a field to
the underlying table. But really, what's the big deal about doing that?
 
D

Douglas J. Steele

Perhaps if you could explain why it has to be an unbound textbox, rather
than bound to a table, we could offer an alternative.
 
G

Guest

On this form, I have already a table as a row source --- You’re telling me to
use another table just for a little txtBox? Well, I guess since there isn’t
any other alternative then that’s what I’m gone have to do. Ricter, I do
appreciate your time, though.
v/r
Adnan
 
G

Guest

It does raise the question of how to store a single value, that is, one
record only, ever, with no "history". Some kind of query to always overwrite
the previous value, I'm not sure...
 
D

Douglas J. Steele

Well, you can't have more than one table as a row source.

You'd either need to create a query that joined the two tables together or,
if that's not possible, use a subform on the main form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top