PC Review


Reply
Thread Tools Rate Thread

Application.ExportXML

 
 
Petr Jankovsky
Guest
Posts: n/a
 
      23rd May 2008
Hello, I have a question about exporting xml using Access. I would like to
export XML data from stored procedure "procedure". This stored procedure have
one parameter "where", lets say
ALTER PROCEDURE procedure(@Where varchar(50)) as
Select * from table where ID = @Where

where table is valid table with column called ID.
I've tried Application.ExportXML acExportStoredProcedure, "procedure",
"C:\xml.xml"
If I run it, input box appears and asks for Where parameter. Is there any
way to pass that parameter via VBA?
 
Reply With Quote
 
 
 
 
Sylvain Lafontaine
Guest
Posts: n/a
 
      26th May 2008
The best way for you might be to directly use the ADO objects; something
like:

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

rs.Open "EXEC test_ExportXML 63", CurrentProject.Connection
rs.Save "C:\test.xml", adPersistXML

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


"Petr Jankovsky" <Petr (E-Mail Removed)> wrote in message
news:79726FD0-B129-4B2D-B040-(E-Mail Removed)...
> Hello, I have a question about exporting xml using Access. I would like to
> export XML data from stored procedure "procedure". This stored procedure
> have
> one parameter "where", lets say
> ALTER PROCEDURE procedure(@Where varchar(50)) as
> Select * from table where ID = @Where
>
> where table is valid table with column called ID.
> I've tried Application.ExportXML acExportStoredProcedure, "procedure",
> "C:\xml.xml"
> If I run it, input box appears and asks for Where parameter. Is there any
> way to pass that parameter via VBA?



 
Reply With Quote
 
Petr Jankovský
Guest
Posts: n/a
 
      26th May 2008
Great, that looks very good. I'm gonna try it soon

"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:(E-Mail Removed)...
> The best way for you might be to directly use the ADO objects; something
> like:
>
> Dim rs As ADODB.Recordset
> Set rs = New ADODB.Recordset
>
> rs.Open "EXEC test_ExportXML 63", CurrentProject.Connection
> rs.Save "C:\test.xml", adPersistXML
>
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail: sylvain aei ca (fill the blanks, no spam please)
>
>
> "Petr Jankovsky" <Petr (E-Mail Removed)> wrote in
> message news:79726FD0-B129-4B2D-B040-(E-Mail Removed)...
>> Hello, I have a question about exporting xml using Access. I would like
>> to
>> export XML data from stored procedure "procedure". This stored procedure
>> have
>> one parameter "where", lets say
>> ALTER PROCEDURE procedure(@Where varchar(50)) as
>> Select * from table where ID = @Where
>>
>> where table is valid table with column called ID.
>> I've tried Application.ExportXML acExportStoredProcedure, "procedure",
>> "C:\xml.xml"
>> If I run it, input box appears and asks for Where parameter. Is there any
>> way to pass that parameter via VBA?

>
>


 
Reply With Quote
 
Petr Jankovský
Guest
Posts: n/a
 
      27th May 2008
OK, this is working, thanks for solution. But I have another question: It is
possible to specify schema file for that output xml?

"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:(E-Mail Removed)...
> The best way for you might be to directly use the ADO objects; something
> like:
>
> Dim rs As ADODB.Recordset
> Set rs = New ADODB.Recordset
>
> rs.Open "EXEC test_ExportXML 63", CurrentProject.Connection
> rs.Save "C:\test.xml", adPersistXML
>
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail: sylvain aei ca (fill the blanks, no spam please)
>
>
> "Petr Jankovsky" <Petr (E-Mail Removed)> wrote in
> message news:79726FD0-B129-4B2D-B040-(E-Mail Removed)...
>> Hello, I have a question about exporting xml using Access. I would like
>> to
>> export XML data from stored procedure "procedure". This stored procedure
>> have
>> one parameter "where", lets say
>> ALTER PROCEDURE procedure(@Where varchar(50)) as
>> Select * from table where ID = @Where
>>
>> where table is valid table with column called ID.
>> I've tried Application.ExportXML acExportStoredProcedure, "procedure",
>> "C:\xml.xml"
>> If I run it, input box appears and asks for Where parameter. Is there any
>> way to pass that parameter via VBA?

>
>


 
Reply With Quote
 
Sylvain Lafontaine
Guest
Posts: n/a
 
      27th May 2008
Sorry, I don't know. The only thing that I know is that you cannot call a
stored procedure with parameters with the Application.ExportXML method.

Another solution for you could be to use a form or a report to call the SP
and then use Application.ExportXML method on this form/report; however, I
never tried it personally.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


"Petr Jankovský" <(E-Mail Removed)> wrote in message
news:06D592C6-95C3-4183-839D-(E-Mail Removed)...
> OK, this is working, thanks for solution. But I have another question: It
> is possible to specify schema file for that output xml?
>
> "Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
> wrote in message news:(E-Mail Removed)...
>> The best way for you might be to directly use the ADO objects; something
>> like:
>>
>> Dim rs As ADODB.Recordset
>> Set rs = New ADODB.Recordset
>>
>> rs.Open "EXEC test_ExportXML 63", CurrentProject.Connection
>> rs.Save "C:\test.xml", adPersistXML
>>
>> --
>> Sylvain Lafontaine, ing.
>> MVP - Technologies Virtual-PC
>> E-mail: sylvain aei ca (fill the blanks, no spam please)
>>
>>
>> "Petr Jankovsky" <Petr (E-Mail Removed)> wrote in
>> message news:79726FD0-B129-4B2D-B040-(E-Mail Removed)...
>>> Hello, I have a question about exporting xml using Access. I would like
>>> to
>>> export XML data from stored procedure "procedure". This stored procedure
>>> have
>>> one parameter "where", lets say
>>> ALTER PROCEDURE procedure(@Where varchar(50)) as
>>> Select * from table where ID = @Where
>>>
>>> where table is valid table with column called ID.
>>> I've tried Application.ExportXML acExportStoredProcedure, "procedure",
>>> "C:\xml.xml"
>>> If I run it, input box appears and asks for Where parameter. Is there
>>> any
>>> way to pass that parameter via VBA?

>>
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ExportXML Jim Murray Microsoft Access External Data 0 8th Feb 2010 07:04 PM
Application.ExportXML exports dates in the wrong format or the 1899 date if date field is empty Jennifer Robertson Microsoft Access VBA Modules 4 2nd Apr 2009 02:57 AM
Problem with Application.ExportXML in Access XP =?Utf-8?B?S2FyaWJ1c3o=?= Microsoft Access VBA Modules 3 19th Oct 2006 09:45 AM
Application.ExportXML problem (sorting) Egbert Nierop \(MVP for IIS\) Microsoft Access 3 26th Sep 2006 05:54 PM
Application.ExportXML gives wrong schema namespace =?Utf-8?B?SmF5?= Microsoft Access Form Coding 0 22nd Dec 2005 02:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:30 PM.