Controlling Change event when loading a form
I have tried both ways with same results. I am going to stick with what I am
doing it, it seems to work. I did some research and downloaded some samples
but in all of them the SAVE button is enabled when form is loaded.
As soon as text box is initialized; events are triggered.
"John_John" wrote:
Hi!
I think that you have to add the above line after the settings of the
textboxes:
frmRouting.cmdSave.Enabled = false
I think it works.
I suggest to use the "AfterUpdate" event of the textbox to enable the button.
John
Ο χρήστης "Gussie" *γγραψε:
Surething. Form gets loaded from the Worksheet_BeforeDoubleClick event:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
.
code
.
.
frmRouting.Show 'Form gets loaded
bLoadingForm = True 'Loading information
frmRouting.txtRoutingID = Activesheet.cells(Target.Row, 1)
frmRouting.txtOrganizationE = Activesheet.cells(Target.Row, 2)
frmRouting.txtOrganizationF = Activesheet.cells(Target.Row, 3)
frmRouting.strLevel = Activesheet.cells(Target.Row, 4)
bLoadingForm = False 'Loading information already completed
.
.
code
.
.
End Sub
The form get loaded prior to loading information and of course all fields
are blank. Then I initialize each field with information from the worksheet,
which hasn't been changed, but it triggers the xxxxxx_Change() for each of
the text fields.
Using that bLoadingForm flag works but I am just curious as how others have
resolve this issue.
Thank you for replying Barb....
"Barb Reinhardt" wrote:
You may want to post your form code.
Barb Reinhardt
"Gussie" wrote:
I created an Excel Form 2000 which triggers when user double-clicks on a row,
loading information into the form. In the form there is a disabled SAVE
button that would be enabled when ever a CHANGE is detected.
The problem:
The CHANGE event gets triggered even while loading form, therefore SAVE
button gets enabled, even though no change has been done yet.
I am currently initializing a variable: LOADING_Flag=true when loading, then
controlling the flag as Initialize process is completed. It works but I was
wondering how others are addressing this issue.
|