Button and Script to save file and run Access 2007 import

  • Thread starter Thread starter IKMD66
  • Start date Start date
I

IKMD66

Hi,

I am a complete novice in this area so please bear with me.....

I am in the process of finalising an access database that is populated
manually and also via xml files received as email attachments. At the moment
the user receiving a valid email has to save the attachment, then run the
import script (using the task button for this purpose - new in access 2007).
Ideally I would like to add a button to the email so that the user can use
this to save the attachment to a predefined directory and run the import as
one step. The icing on the cake would be to delete the file after import -
this would just keep things very tidy.

Can anyone point me in the correct direction and provide example code
required to do this.

Greatly appreciate your time and advice.

Thanks in advance.
Kirk
 
The only way to put a button on an email message so that it can run code is to use a custom Outlook form published either to your company's Organizational Forms library, if you use Exchange for mail, or to each recipient's Personal Forms library. If you can meet that prerequisite, the Outlook portion of the code would call the Attachment.SaveAsFile method.
 
Sue,

Thanks for the prompt response - I don't think we would even go there with
custom forms. Would an alternative approach be to move the form to a folder
where programming could automatically process the steps required?......Is
this a valid approach and if so can you provide any guidance.

Again - thank you for your time.

Regards,
Kirk
 
move the form to a folder where programming could automatically process the steps required <<

You mean move the *item*, right? The form, in an Outlook context, is just a code/UI template, containing no data. This would require one of the following, roughly in order of complexity (both coding and administrative/deployment):

1) VBA code on an Outlook machine that has access to the folder and is running 24/7 or at least during the hours when items might be moved into the folder.

2) Same as #1, only an add-in instead of VBA code -- more reliable in the long run.

3) If the folder is on an Exchange server, an Exchange event sink.

Have you looked into InfoPath at all? With its native XML support and ability to connect with a database, it might be a better solution in general for the type of application you have in mind.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Thanks Sue.

I haven't looked at InfoPath, but will consider based on your response.

Regards,
Kirk
 
Back
Top