• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

Capturing which button closes the Attachment Management dialog box

I'm using the code in the subroutine below to open the attachment management dialog box.  I have a situation where I want to perform one action if the user attaches a file and another action if the user simply closes the dialog box with the cancel button.  How can I capture whether the dialog was closed using the "Cancel" button or not...???
Private Sub btnOpenDocument_Click()
DoCmd.GoToControl "MyAttachment"
Application.RunCommand (acCmdManageAttachments)
End Sub
'MyAttachmet is the name of the Attachment control on the form

Open in new window

1 Solution
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I'm not sure you can ... your code does nothing more than show the Attachments dialog box, and then relinquishes control to that dialog.

You could check the Attachment field before and after to see if a new attachment has been inserted.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now