Executing code based on changes made to a form ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

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

Back
Top