Format Change on Export

Leesha
BronzeLounger
Posts: 1484
Joined: 05 Feb 2010, 22:25

Format Change on Export

Post by Leesha »

Hi!
I am using the code below to export a file from Access to Excel. There are two columns that are set to Yes/No format and the lookup setting is set to Textbox. All looks well until I export it. At that point the Yes/No is changed to True/False. The user wants Yes/No. This happens even when I manually export it and click the option to maintain formatting. Is there any way to correct this?

Thanks!
Leesha

'Exports reports to be attached to email
DoCmd.OutputTo acQuery, "qryContactInformation", acFormatXLSX, "C:\Walmart\OutputFiles\qryContactInformation.xlsx"

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Format Change on Export

Post by HansV »

The export transfers the actual value of the Yes/No fields.
Instead of including the Yes/No fields themselves in the query. create columns like this:

Format([FieldName],"Yes/No")

These will be exported as text values.
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1484
Joined: 05 Feb 2010, 22:25

Re: Format Change on Export

Post by Leesha »

Good to know! Thanks Hans, it worked perfectly!
Leesha