export query to excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a simple question.
I am exporting a file to excel. My table/query has field1 that is a check
box. When I export it, it shows as TRUE or FALSE. Not very user friendly.
Is there a way to modify what is outputted to excel without having to create
a new field in my table?
Basically I want the TRUE to be exported as YES and FALSE to be exported as
NO.

The query is nothing fancy, just select all from 1 table.
Here is the line of code to export the query. (Once again, nothing fancy)

DoCmd.OutputTo acQuery, "export", "MicrosoftExcel(*.xls)", "", True, "",0

Your assistance is appreciated,
 
David,

In the design view of your table, look at the Format property of the
Yes/No field. If it is formatted as True/False, you could try changing
it to Yes/No and see if that does the trick. If not, go to the design
view of the "export" query, and similarly check the Format property of
the field in question... it probably won't have any entry at the moment,
so you could set it to Yes/No, and see if that does the trick. If not,
you can make a calculated column in the query, in the place of the
existing Yes/No field, like this...
NewYesNo: Switch([YourYesNoField]=-1,"Yes",[YourYesNoField]=0,"No")
 
Thank you Steve,
The line of code in my query worked perfectly.

David

Steve Schapel said:
David,

In the design view of your table, look at the Format property of the
Yes/No field. If it is formatted as True/False, you could try changing
it to Yes/No and see if that does the trick. If not, go to the design
view of the "export" query, and similarly check the Format property of
the field in question... it probably won't have any entry at the moment,
so you could set it to Yes/No, and see if that does the trick. If not,
you can make a calculated column in the query, in the place of the
existing Yes/No field, like this...
NewYesNo: Switch([YourYesNoField]=-1,"Yes",[YourYesNoField]=0,"No")

--
Steve Schapel, Microsoft Access MVP

I have a simple question.
I am exporting a file to excel. My table/query has field1 that is a check
box. When I export it, it shows as TRUE or FALSE. Not very user friendly.
Is there a way to modify what is outputted to excel without having to create
a new field in my table?
Basically I want the TRUE to be exported as YES and FALSE to be exported as
NO.

The query is nothing fancy, just select all from 1 table.
Here is the line of code to export the query. (Once again, nothing fancy)

DoCmd.OutputTo acQuery, "export", "MicrosoftExcel(*.xls)", "", True, "",0

Your assistance is appreciated,
 
David,

Can you tell me where you enter the following code for exporting queries to
excel as I'm trying to do something similar.

Regards

David said:
Thank you Steve,
The line of code in my query worked perfectly.

David

Steve Schapel said:
David,

In the design view of your table, look at the Format property of the
Yes/No field. If it is formatted as True/False, you could try changing
it to Yes/No and see if that does the trick. If not, go to the design
view of the "export" query, and similarly check the Format property of
the field in question... it probably won't have any entry at the moment,
so you could set it to Yes/No, and see if that does the trick. If not,
you can make a calculated column in the query, in the place of the
existing Yes/No field, like this...
NewYesNo: Switch([YourYesNoField]=-1,"Yes",[YourYesNoField]=0,"No")

--
Steve Schapel, Microsoft Access MVP

I have a simple question.
I am exporting a file to excel. My table/query has field1 that is a check
box. When I export it, it shows as TRUE or FALSE. Not very user friendly.
Is there a way to modify what is outputted to excel without having to create
a new field in my table?
Basically I want the TRUE to be exported as YES and FALSE to be exported as
NO.

The query is nothing fancy, just select all from 1 table.
Here is the line of code to export the query. (Once again, nothing fancy)

DoCmd.OutputTo acQuery, "export", "MicrosoftExcel(*.xls)", "", True, "",0

Your assistance is appreciated,
 
Back
Top