PDA

View Full Version : How to force a form to update?



prabhafriend
07-28-2010, 08:04 AM
I have an 'authorise later' command button in a 'Create Coordinator' form.
Sub Authorise_later_click()
DoCmd.Close acForm, Me.Name, acSaveNo
End sub
The problem is if the current record violates the field settings it neither show the error message nor save the record.

How to explicitly force to form to updates the last record before closing the form?

HiTechCoach
07-28-2010, 08:54 PM
I have an 'authorise later' command button in a 'Create Coordinator' form.
Sub Authorise_later_click()
DoCmd.Close acForm, Me.Name, acSaveNo
End sub
The problem is if the current record violates the field settings it neither show the error message nor save the record.

How to explicitly force to form to updates the last record before closing the form?

Try this:




Sub Authorise_later_click()
' save record if needed
If Me.Dirty Then Me.Dirty = False

DoCmd.Close acForm, Me.Name, acSaveNo
End sub