R
Rico
Hello,
I have an issue that I'm actually dealing with in a VB6 app, but was
wondering if someone here happens to have an answer for this that I could
port to the VB6 app.
Is there a way to call an event from a string? I know I've seen code
that looks similar to the following;
Controls(control.name)("Validate") or
Controls(control.name).Events("Validate")
....at some point in my travels, but can't recall what the syntax was. The
reason I'm looking to do this is because the validate events on each field
are validating the data entered, setting the class properties and upon
leaving the form, are saving the values to the database through the
class.save method. The problem is when someone clicks on the "X" to close
the form down, the validate event does not fire. What I need to do is on
the UnloadQuery event of the form, cycle through the
controls and where the control does not equal the class property, run the
validate event. If the field is valid, then set the class property and
save, otherwise cancel the unloadquery event (similar to close or unload).
I know I've seen similar code and I'm sure it's not the last time it would
come in handy.
Any help would be appreciated.
Thanks!
Rick
I have an issue that I'm actually dealing with in a VB6 app, but was
wondering if someone here happens to have an answer for this that I could
port to the VB6 app.
Is there a way to call an event from a string? I know I've seen code
that looks similar to the following;
Controls(control.name)("Validate") or
Controls(control.name).Events("Validate")
....at some point in my travels, but can't recall what the syntax was. The
reason I'm looking to do this is because the validate events on each field
are validating the data entered, setting the class properties and upon
leaving the form, are saving the values to the database through the
class.save method. The problem is when someone clicks on the "X" to close
the form down, the validate event does not fire. What I need to do is on
the UnloadQuery event of the form, cycle through the
controls and where the control does not equal the class property, run the
validate event. If the field is valid, then set the class property and
save, otherwise cancel the unloadquery event (similar to close or unload).
I know I've seen similar code and I'm sure it's not the last time it would
come in handy.
Any help would be appreciated.
Thanks!
Rick