View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Executing code based on changes made to a form ?

Is the textbox always blank when the form is shown.

If so, why not just check if it is still blank or if it has a default value,
if it still has the default value.

--
Regards,
Tom Ogilvy



"Dan Thompson" wrote in message
...
I have a form with a textbox on it and "Go" Command button
What I am trying to accomplish is when I click the Go button on my form I
would
like like vba to check to see if MyTextBox has been changed at all, ie..

new
data has been typed in to Mytextbox or even if it has just been clicked

on.
The problem I am having is my program is supposed to set "TxtBoxModified"
variable to True if the textbox on my form has been edited or changed at

all.
However when I load the form and just click on the "Go" Command button VBA
sets the variable "TxtBoxModified"
to true even if I didn't click or change anything with the textbox on my

form.

Why is this not working ?
Any thoughts would be appreciated my form code is as follows
_____________________________
Dim TxtBoxModified as Boolean

Private Sub MyTxtBox_Change()
TxtBoxModified = True
End Sub

Private Sub cmdGoButtons_Click()
MsgBox (TextBoxModified)
End Sub
-----------------------------------------------

Dan Thompson