473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Export parameter query to xml

Hello, I'm having a problem trying to export output to an xml format.

I have a query that uses a form field as the query criteria. I want the query to execute without the prompt for the criteria.

This is the sql of the query:
Expand|Select|Wrap|Line Numbers
  1. SELECT FldRptsQueryPt1.*, FldRptsQueryPt1.rmsDetails.rmsNumber
  2. FROM FldRptsQueryPt1 LEFT JOIN OffensesQuery ON FldRptsQueryPt1.rmsDetails.rmsNumber = OffensesQuery.Offenses_rmsNumber
  3. WHERE (((FldRptsQueryPt1.rmsDetails.rmsNumber)=[Forms]![rmsDetails]![rmsNumber]));
The code I'm using to run the query is under a button on the rmsDetails form:
Expand|Select|Wrap|Line Numbers
  1. Application.ExportXML _
  2.     ObjectType:=acExportQuery, _
  3.     DataSource:="FldRptsQuery", _
  4.     DataTarget:="C:\FldRptsQuery.xml"

From the query window the query works when the form rmsDetails is open.

When I use the button on the form I get the prompt to supply the rmsNumber and then the data is exported. I would like to get rid of the prompt for the rmsNnumber.

I'm new to access so I don't know if I'm using the right approach for this situation.

Thanks you.
Feb 1 '08 #1
5 6549
Hello, I'm having a problem trying to export output to an xml format.

I have a query that uses a form field as the query criteria. I want the query to execute without the prompt for the criteria.

This is the sql of the query:
SELECT FldRptsQueryPt1.*, FldRptsQueryPt1.rmsDetails.rmsNumber
FROM FldRptsQueryPt1 LEFT JOIN OffensesQuery ON FldRptsQueryPt1.rmsDetails.rmsNumber = OffensesQuery.Offenses_rmsNumber
WHERE (((FldRptsQueryPt1.rmsDetails.rmsNumber)=[Forms]![rmsDetails]![rmsNumber]));

The code I'm using to run the query is under a button on the rmsDetails form:
Application.ExportXML _
ObjectType:=acExportQuery, _
DataSource:="FldRptsQuery", _
DataTarget:="C:\FldRptsQuery.xml"


From the query window the query works when the form rmsDetails is open.

When I use the button on the form I get the prompt to supply the rmsNumber and then the data is exported. I would like to get rid of the prompt for the rmsNnumber.

I'm new to access so I don't know if I'm using the right approach for this situation.

Thanks you.
I found a solution. I'm posting here in case some one else may run into the same situation.

I removed the criteria from the query and used the filter criteria option on the exportxml method. My new export statement is:

Application.ExportXML _
ObjectType:=acExportQuery, _
DataSource:="FldRptsQuery", _
DataTarget:="C:\FldRptsQuery.xml", _
WhereCondition:="FldRptsQueryPt1.rmsDetails.rmsNum ber = '" & Forms!rmsDetails![rmsNumber] & "'"


My app now exports to an xml format without requesting input form the user.

Notice the "WhereCondition:=", in a lot the samples I ran across I saw "FilterCriteria" which does not work for me with Access 2003. My app does not deal with thousands of records so the filter option works for me. If you have to read lots of records this may not work for you.

Again I'm new to Access but the above method does work.
Feb 1 '08 #2
Hi,

I have the exact function you used for exporting a query using a parameter however I am getting an error of "Run - time error '31532'
Microsoft Access was unable to export the data".

Do you have any idea why is this happening?
Jun 11 '14 #3
twinnyfo
3,653 Expert Mod 2GB
flyishfish15,

Do you have the same version of MS Access as ladylexus? This could be an initial starting point for your issue.
Jun 11 '14 #4
Hi twinnyfo my version of Access is MS Access 2013..Does this have any compatibility issue with MS Office 2013?
Jun 12 '14 #5
twinnyfo
3,653 Expert Mod 2GB
flyingfish,

Your version of Acces (2013) should be fully compatible with MS Office 2013. However, if you are using code from a previous verison of Access it "could" affect your exports. I have only run into problems during exports like this--but it is rare.

At the same time, I have had lines of code work for years, and then all of a sudden, they will generate an error. Access is also not very informative when an error is generated. I wish I had better advice, but the OP did did find resolution.

Now, if we could only solve your issue....
Jun 12 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: DMina | last post by:
Hello people! I am a bit puzzled here so any help will be much appreciated. Here is the situation: I have a query which selects all the data based on a date column. I need all the data which...
1
by: Michael | last post by:
I have an application that will export two files to fixed width text to combine as a single text file. The first export will be a query containing header information for the file, the second query...
2
by: JMCN | last post by:
is it possible to export multiple queries into one workbook, having each query as separate worksheet? i cannot specify a range because the records will change on a daily basis as for query size. i...
8
by: stoppal | last post by:
I have a sql statement: "SELECT Field1,field2 FROM table WHERE field1="!" I need to export this to a CSV file with header information. How can I do this? I've tried the below function...
0
by: Henry | last post by:
I have written an ASP/VB.Net application via VS 2003 (Crystal V9) that uses MS Access 2000 as its database. I can export reports that have no linked sub reports for printing. However, I'm unable...
1
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm...
1
by: cdun2 | last post by:
Hello, I have a parameter query called 'Rev by AcctCode' that takes it's value from a form field; Forms!!. I am trying to find a way to run this query, get the parameter value to it, and populate...
2
by: Access user | last post by:
My apologies for crossposting this, but I did not get any response in microsoft.public.access ...
0
by: sknayeemuddin | last post by:
Hi All, I am migrating the data from DB2 to oracle 10g. while exporting data from DB2 to some external files, i am able to export the data but when i want to export the data with columns name i...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.