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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking live form data changes

Status
Not open for further replies.

Domino2

Technical User
Jun 8, 2008
475
GB
I have a subform with 8 fields. I am trying to enable a save button if the user changes the data in any field, and disables the save button if the user retypes in the original data. I have tried using the oldvalue property but it's not reliable, don't know if the cycling through all fields is somehow leaving the subform to the mainform and being saved.

Is there a more reliable way of doing this?. I am using the fields beforeupdate, my controls are bound.

Appreciate any help, trying to get passed problem. Thanks
 
How are ya Domino2 . . .

Your fighting with [blue]Edit Mode[/blue] and the way access saves records. Also you should be pinging against the controls [blue].Text[/blue] property (its uncomitted value) instead of its value.

When you edit a control in a record, access puts the entire record in [blue]Edit Mode[/blue]. In this state, when you tab out of the last control in the [blue]tab order[/blue] ... access automatically saves (this defeats your save button). To circumvent this set the forms [blue]Cycle[/blue] property to [blue]Current Record[/blue].

As for controlling your save button, you'll need something like the following in the [blue]Before Update[/blue] event of each of the eight controls:
Code:
[blue]Me.[purple][B][I]SaveButtonName[/I][/B][/purple].Enabled = (Me![purple][B][I]YourControlName[/I][/B][/purple].OldValue = Me![purple][B][I]YourControlName[/I][/B][/purple].Text)[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top