Daniel (1 Viewer)

dalanaaccess

New member
Local time
Yesterday, 21: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:
 

missinglinq

AWF VIP
Local time
Today, 00:07
Joined
Jun 20, 2003
Messages
6,423
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)>
 

dalanaaccess

New member
Local time
Yesterday, 21:07
Joined
Feb 13, 2018
Messages
7
Thank you, I will try that.
 

dalanaaccess

New member
Local time
Yesterday, 21:07
Joined
Feb 13, 2018
Messages
7
Works Great!! Thank you so much. I spend 3 days and you provide solution in few seconds. Very impressive.
 

Mark_

Longboard on the internet
Local time
Yesterday, 21:07
Joined
Sep 12, 2017
Messages
2,111
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

Top Bottom