Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI & Database 1

Status
Not open for further replies.

MadsC

Programmer
Joined
Jan 31, 2003
Messages
19
Location
GB
I have a MDI database application. Text Boxes on a child form are linked to an ADO recordset. I want to update the MDI menu to highlight 'Save Changes' when I change data in one of the linked text boxes.

In most instances I can use the validate event to detect changes. However, as this event is only fired when the text box loses focus my menu is not updated when text is changed if I don't move focus.

I don't want to use on change as this event is triggered every time I move to the Next or Previous record in the recordset
 
If the textboxes are bound to a datasource then declare your recordset object in the declarations section of the form class using WithEvents, (unless you are using the Adodc - then you do not need to) and then use the event:

rsADO_FieldChangeComplete

and enable the save button or whatever
 
Thanks. I've already tried the ADO WillChangeField event. However this again doesn't trigger until focus has moved from the text box. I presume the rsADO_FieldChangeComplete event fires after the willchangefield.
 

Then you will need to use the control's Change event...
 
I can put a flag in the change event to tell me that the text box has been modded. Unfortunately the change event is triggered every time that I do a movenext.

I would need to set a flag every time I do a movenext, to tell me not to change the MDI menu, then if the change event is triggered again while in the same record change the menu. Could try and do it that way, but a bit messy.
 

You could just first varify if the data in the textbox is the same value as in the recordset.
This may only work when the data comming from the rs is not formated.

Another way is to just have a private variable m_LoadingData As Boolean and set this to True when the data is being retreived, and to false afterwards.

How about the KeyPress event?

If not cmdSave.Enabled then cmdSave.Enabled = True
 
Cheers CCLINT, Think I'll run with the private variable, little messy I feel, but simple!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top