How to update bound form record externally

V

Vinod

Hi All,

Here is my requirement,

There is a sub-form with table/query source, user will change existed data
in each and every field. To update the table with user changes user has to
click update button otherwise it should not update changes in table.

Please share your thought and ideas in my requirement and if it is possible
provide what code could be call after clicking 'Update' button.

Note: There 40 fields in subform.

Advanced thanks
Vinod.
 
T

TonyT

Hi Vinod,

in the OnClick event of your command button have;
If Me.Dirty Then
Me.Dirty = False
End If

This will save the record of any bound form that has had changes made to its
recordsource.

hth

TonyT..
 
V

Vinod

Thanks Tony for your response,

Its working fine but if I close the from without clicking on update button
my changes are reflecting in record source table.

Just to share an alternative code for your code is as follows:
Me.Recordset.Edit
Me.Recordset.Update

Unfortunatly your code is not suiting for my requirment since without
clicking update and closing form table is updated.

Please share if you have any other thoughts.

Thanks & Regards
Vinod
 
V

Vinod

Hi Tony,

Just to update you I've written Me.Undo in close button. Now its not
updating any changes mader after clicking 'update' button.

Thanks and Regards
Vinod
 
T

TonyT

In which case you need to use the BeforeUpdate event of the form to check
whether you are happy with the data entered and the method that the user is
using to exit the form, from there you can cancel the update (Cancel = -1) or
prompt the user to enter any missing information, Or just put up a message
saying 'You haven't pressed Save or Cancel' and cancelling the event until
the user gets it right.

TonyT..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top