Results 1 to 2 of 2

Thread: How to save the information in the form if it accidentally gets closed?

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2013
    Posts
    5

    Question How to save the information in the form if it accidentally gets closed?

    Hi,

    I have a form which has a list box and text box with employee details. The form is used to track day to day activities. The form should be opened for 9 hours continuously. But automatic system restart or mandatory reboot in the mid of the working hours makes it difficult to save the details. How to do this using VBA. I've tried "DoCmd.Runcommand acCmdSaveRecord" in the code but of no use.

    Any suggestions?

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: How to save the information in the form if it accidentally gets closed?

    while vba userforms have an event
    Code:
    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
       'code here will run if form tries to close
    End Sub
    i do not know if access forms have a similar event
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width