Daniel

dalanaaccess

New member
Local time
, 17:07
Joined
Feb 13, 2018
Messages
7
Hi All,

I am trying to export only one record out of table to XML file.
Of coursee I have qry ready and running qry only out of code works great.

When I am using following code it is not showing anything, but it also not creating file.

Application.ExportXML ObjectType:=acExportQuery, _
DataSource:="qryNW", _
DataTarget:="C:\DB\Customer.XML", _
WhereCondition:="[OrderNumber] = " & txtOrderNumber.Value

If I remove WhereCondition it is creating file, but includes all records from table that qry is running on.

Please help. :banghead:
 
Is [OrderNumber] actually defined as a Number or is it defined as Text?

If defined as Text, the correct syntax would be

"[OrderNumber] = '" & txtOrderNumber.Value & "'"

Linq ;0)>
 
Thank you, I will try that.
 
Works Great!! Thank you so much. I spend 3 days and you provide solution in few seconds. Very impressive.
 
Something that may also help down the road;

txtOrderNumber.Value is ambiguous in some ways. Me.TxtOrderNumber will clearly specify it is a control on your form/report. Value is the default so is not needed.

If you are using VBA then the editor can use Me. and automatically figure out valid values. This can help in avoiding improper use of methods.
 

Users who are viewing this thread

Back
Top Bottom