Refresh field on Form

R

Rubie

Hello,

How can I refresh a field on a form without closing the form? When the form
is closed to refresh, it causes the data in my input field to disappear.

Thanks in advance.
 
T

tkelley via AccessMonster.com

I'm not quite sure what you want to do.

If you want to commit changes that are in your form without closing:
DoCmd.RunCommand acCmdSaveRecord

If you want to requery the form without closing:
me.requery

Does that help?
 
R

Rubie

Thanks for responding tkelley. I want to refresh data in two fields on my
form and keep the data in the input field that's entered once each morning.
Not sure of where to put the me.query. Tried that once and got an error
message. Does me.query have to be setup as a macro first?
 
T

tkelley via AccessMonster.com

It's Me.Requery not Me.Query.

And it can go in any event, like the click event of a button. If the requery
clears out the input field, then just declare a variable, set the variable to
that value, requery, then put the variable value back in your field.

=====================
'put this in your event
Dim strInputValue as String
strInputValue = Me.MyInputField
Me.Requery
Me.MyInputField = strInputValue

Thanks for responding tkelley. I want to refresh data in two fields on my
form and keep the data in the input field that's entered once each morning.
Not sure of where to put the me.query. Tried that once and got an error
message. Does me.query have to be setup as a macro first?
I'm not quite sure what you want to do.
[quoted text clipped - 12 lines]
 
R

Rubie

Thanks tkelley. I found the answers to the Requery action in the help menu.
I added it to the Timer in the form properties. Thanks again.

tkelley via AccessMonster.com said:
It's Me.Requery not Me.Query.

And it can go in any event, like the click event of a button. If the requery
clears out the input field, then just declare a variable, set the variable to
that value, requery, then put the variable value back in your field.

=====================
'put this in your event
Dim strInputValue as String
strInputValue = Me.MyInputField
Me.Requery
Me.MyInputField = strInputValue

Thanks for responding tkelley. I want to refresh data in two fields on my
form and keep the data in the input field that's entered once each morning.
Not sure of where to put the me.query. Tried that once and got an error
message. Does me.query have to be setup as a macro first?
I'm not quite sure what you want to do.
[quoted text clipped - 12 lines]
Thanks in advance.
 

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