Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Has something been written?

Geek News

Has something been written?
Proko 11/27/2008 11:02:00 PM
I have an unbound text box on a form. I would like to give the user the
opportunity to save the contents of the text box only when something has been
written in it. That is, my save button is not enabled until the length of the
string is greater than zero.
I tried using the key up event with:
if len([mytextbox]) > 0 then
mysavebutton.enabled = true
end if
Can't seem to get it to work though.
I would also like the save button to become disabled again if the user
starts to type something in the text box but then deletes or backspaces all
of what has been written.
Any help would be greatly appreciated.
Proko


Re: Has something been written?
"Linq Adams via AccessMonster.com" <u28780[ at ]uwe> 11/27/2008 11:46:21 PM
Use the OnChange event with the Text Property of the textbox. You have to set
the Enabled Property for the MySaveButton to No in the Properties Sheet so
that it starts off Disabled.

Private Sub MyTextBox_Change()
If Len(Me.MyTextBox.Text) > 0 Then
MySaveButton.Enabled = True
Else
MySaveButton.Enabled = False
End If
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net