Group:  Microsoft Access ยป microsoft.public.access.externaldata
Thread: Export query to xml and mail that.

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Export query to xml and mail that.
pnp 05.07.2006 12:03:02
Hi

I have a small problem figuring out how to do <subject>.

What i would like to happen is that I have a query defined in my Access
database, when i push a button, I would like to save this query as xml and
send it as an attachment to an email.

I can do just that, just sending data as Excel instead of XML. By using the
macro SendObject I can select a query and select type. But here I can't
select XML.

If i select export on the query I can select to XML, but how do i automate
this, and put it in a mail?

Hope somebody can help me.

/Anders
RE: Export query to xml and mail that.
pnp 05.07.2006 13:33:02
Fixed the problem reading some different sites.

Made a vb macro with the following code:


-------- CODE BEGIN --------

sub sendQueryAsXML
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String

Subjectline = "eMail subject"
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)

sXMLPath = CurrentProject.Path & "\AccessEXP.xml"

If Dir(sXMLPath) <> "" Then Kill sXMLPath
ExportXML acExportQuery, "QUERYNAME", sXMLPath

MyMail.Subject = Subjectline
MyMail.Attachments.Add(sXMLPath)

MyMail.Display = true

end sub

--------- CODE END ---------

Best regards
/Anders
"pnp" wrote:

[Quoted Text]
> Hi
>
> I have a small problem figuring out how to do <subject>.
>
> What i would like to happen is that I have a query defined in my Access
> database, when i push a button, I would like to save this query as xml and
> send it as an attachment to an email.
>
> I can do just that, just sending data as Excel instead of XML. By using the
> macro SendObject I can select a query and select type. But here I can't
> select XML.
>
> If i select export on the query I can select to XML, but how do i automate
> this, and put it in a mail?
>
> Hope somebody can help me.
>
> /Anders

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net