Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Executing code based on changes made to a form ?

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FINDING AN EXACT MATCH ON 2 DIFFERENT SHEETS THEN EXECUTING A FORM Morton Detwyler[_2_] Excel Worksheet Functions 3 December 2nd 08 06:58 PM
Can a form made in Excel 2002 be converted into a fillable form? Paraclete Excel Discussion (Misc queries) 1 February 20th 07 09:20 PM
Code not executing iwrk4dedpr[_6_] Excel Programming 3 June 3rd 04 07:48 AM
VBA code stops executing Mark Kubicki Excel Programming 0 December 3rd 03 06:47 PM
Code Changes Not Executing Justin[_8_] Excel Programming 1 October 24th 03 02:31 AM


All times are GMT +1. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"