Consulting

Results 1 to 2 of 2

Thread: How to force a form to update?

  1. #1

    How to force a form to update?

    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?

  2. #2
    Quote Originally Posted by prabhafriend
    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
    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •