Rrefresh/clear a field on submit

R

RitchieJHicks

hi,

I have 2 fields - notessubmit and notes. My form is set so that when the
user hits a command button, the text from the notessubmit field is added to
the notes field.

The notessubmit field has a default value of Now() (so that the user doesn't
have to type the date and time each time). However, when they click the
command button although the text is added to the notes field, the notesubmit
field is not cleared/reset and the text remain there.

That means that my users have to exit the database and open it again to
clear the field and reset the date.

I have tried a lost focus repaint and refresh but these have no effect.

Can anyone advise me the best way to "reset" my notesubmit field after the
user submits the notes, please?
 
S

Stockwell43

Here is some air code. I tried it in my CustFirst and CustLast fields where
the first name is entered and I click the button and it moves the first name
to the last name field and then the first name field goes blank. Not sure if
this will work for you but try it in the on click event of your button.

Me.notes = Me.notessubmit
Me.notessubmit = Null
 
M

Maurice

You could try the .oldvalue and set that to the control to see if that gives
back what you are looking for.

So me.notesubmit=me.notesubmit.oldvalue

hth
 
R

RitchieJHicks

Hi Maurice,

Your suggestion me.notesubmit="" was almost there. When I looked at it
logically (and bearing in mind I know little code) I changed it to:

me.notesubmit=Now()

which did the trick. So, my code looks like:

Private Sub DoNotesCommand_Click()
Dim strNotes As String

strNotes = Me.Notes.Value

Me.Notes.Value = Me.Notessubmit.Value & Chr(13) & Chr(10) & Chr(13) &
Chr(10) & strNotes
Me.Notessubmit = Now()

End Sub

Thanks for your help.
 

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