Hello
How can I create a button in form to open attachment window by clicking on it using macros or vba?
Thanks in advance
Hello
How can I create a button in form to open attachment window by clicking on it using macros or vba?
Thanks in advance
I have no idea what an attachment window is. Maybe you're wanting to open the file? The attachment is in a table field (not a good idea)? If so, is the attachment field part of the form's records?
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
this is supposed to work but does not for me (get error message "The command or action 'Manage Attachments' isn't available now". Perhaps it is an Access version problem. Focus IS set to the attachment field so I know that part works. You would have to substitute the name of your attachment field control name on the form and see what happens
I also tried what is supposed to replicate the double click event with SendKeys but that does nothing.Code:Me("tblAttachment.CrosstabTest.FileData").SetFocus DoCmd.RunCommand acCmdManageAttachments
That being said, experience Access developers would not store attachments in tables anyway, in favour of storing file paths to the files. Maybe you shouldn't either
I might play with it some more, but no promises. Maybe the problem is that it's not something that can be done from a form that has an attachment field
Cross post https://stackoverflow.com/questions/...form-by-button
Code works for me.
Me.attachmentcontrolname.SetFocus
DoCmd.RunCommand acCmdManageAttachments
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Interesting. I get the error, as mentioned. You are using 2010 so maybe it IS a version thing.
Note: Me.attachmentcontrolname.SetFocus also produced an error for me. That's why I posted
Me("tblAttachment.CrosstabTest.FileData")
Also, thanks for the cross post note. If the OP doesn't acknowledge the error of their ways, I usually add them to my ignore list because I have no desire to waste my time. However, you didn't post the usual link to what's wrong with that, so I will:
ali_sh - if you have not already been asked to do so, please review
https://www.excelguru.ca/content.php?184