Exporting to Excel 2002 changes date cells

  • Thread starter Thread starter JudyB
  • Start date Start date
J

JudyB

We have a query which includes several date fields. When exported to Excel
2002, the date fields change to text, and only through several steps can be
changed back to date fields for use in pivot tables and other analysis. Is
there an easier way to ensure that all date fields come through as
legitimate date fields and stay that way? We tried turning off the Error
Checking options in Excel before bringing the data in, but this does not
help.
 
Your problem is the reverse of what I usually see....text fields changing to
dates.

Please post more info such as the SQL of the query, info about the table's
fields (format, data content), and how you're doing the export.
 
The data we are exporting is actually a query made up of several tables.
All the date fields in the tables are a data type of Date/Time with the
format set as Short Date. We tried both the Office Links and just
copy/paste to bring the information into Excel. We get the same results.
If you still need the SQL language for the query, it will be just a couple
days for me to get that (I am not at the same location as the database!).
Thanks in advance for any help!!
JB
 
We created the query using design view, and after looking at the SQL
language in the query, I can see that it was created from another query, not
the various tables directly. Here is the language taken from the SQL view
of the query we are attempting to export to Excel (I hope this is what you
were referring to):

SELECT [qryReceipts&Parts].BWTagID, tblRMA.CustomerID,
tblCustomerInformation.CustomerName, [qryReceipts&Parts].CustomerTagNo,
[qryReceipts&Parts].RMAID, [qryReceipts&Parts].PartNumberID,
[qryReceipts&Parts].PartNumAndRev, [qryReceipts&Parts].PartDescription,
[qryReceipts&Parts].CodeGroup, [qryReceipts&Parts].CodeDescription,
[qryReceipts&Parts].AcctType, [qryReceipts&Parts].Suffix,
[qryReceipts&Parts].AcctSuffix, [qryReceipts&Parts].NewDateCode,
[qryReceipts&Parts].InserviceDate, [qryReceipts&Parts].FailureDate,
[qryReceipts&Parts].InvalidDates, [qryReceipts&Parts].BWFixDateCode,
[qryReceipts&Parts].BWResp, [qryReceipts&Parts].[PartNum&Suffix],
[qryReceipts&Parts].Mileage, [qryReceipts&Parts].DaysToFailFromMfg,
[qryReceipts&Parts].MonthsToFailFromMfg,
[qryReceipts&Parts].DaysUntilFailureInservice,
[qryReceipts&Parts].MonthsToFailureInservice,
[qryReceipts&Parts].PlantReturnQuantity,
[qryReceipts&Parts].SpecificComplaint, [qryReceipts&Parts].DateReceived,
[qryReceipts&Parts].InputBy, [qryReceipts&Parts].BWTagID,
[qryReceipts&Parts].TestPass, [qryReceipts&Parts].TestFail,
[qryReceipts&Parts].FailureClassificationCode,
[qryReceipts&Parts].FailureSubCode, [qryReceipts&Parts].Result,
[qryReceipts&Parts].Comment, [qryReceipts&Parts].AnalysisDate,
[qryReceipts&Parts].AnalysisBy, [qryReceipts&Parts].AnalysisComplete,
[qryReceipts&Parts].Symptom

FROM ([qryReceipts&Parts] LEFT JOIN tblRMA ON [qryReceipts&Parts].RMAID =
tblRMA.RMAID) LEFT JOIN tblCustomerInformation ON tblRMA.CustomerID =
tblCustomerInformation.CustomerID;

Thanks again! - jb
 
Please post the SQL of the qryReceipts&Parts query too. Thanks.

--
Ken Snell
<MS ACCESS MVP>

JudyB said:
We created the query using design view, and after looking at the SQL
language in the query, I can see that it was created from another query, not
the various tables directly. Here is the language taken from the SQL view
of the query we are attempting to export to Excel (I hope this is what you
were referring to):

SELECT [qryReceipts&Parts].BWTagID, tblRMA.CustomerID,
tblCustomerInformation.CustomerName, [qryReceipts&Parts].CustomerTagNo,
[qryReceipts&Parts].RMAID, [qryReceipts&Parts].PartNumberID,
[qryReceipts&Parts].PartNumAndRev, [qryReceipts&Parts].PartDescription,
[qryReceipts&Parts].CodeGroup, [qryReceipts&Parts].CodeDescription,
[qryReceipts&Parts].AcctType, [qryReceipts&Parts].Suffix,
[qryReceipts&Parts].AcctSuffix, [qryReceipts&Parts].NewDateCode,
[qryReceipts&Parts].InserviceDate, [qryReceipts&Parts].FailureDate,
[qryReceipts&Parts].InvalidDates, [qryReceipts&Parts].BWFixDateCode,
[qryReceipts&Parts].BWResp, [qryReceipts&Parts].[PartNum&Suffix],
[qryReceipts&Parts].Mileage, [qryReceipts&Parts].DaysToFailFromMfg,
[qryReceipts&Parts].MonthsToFailFromMfg,
[qryReceipts&Parts].DaysUntilFailureInservice,
[qryReceipts&Parts].MonthsToFailureInservice,
[qryReceipts&Parts].PlantReturnQuantity,
[qryReceipts&Parts].SpecificComplaint, [qryReceipts&Parts].DateReceived,
[qryReceipts&Parts].InputBy, [qryReceipts&Parts].BWTagID,
[qryReceipts&Parts].TestPass, [qryReceipts&Parts].TestFail,
[qryReceipts&Parts].FailureClassificationCode,
[qryReceipts&Parts].FailureSubCode, [qryReceipts&Parts].Result,
[qryReceipts&Parts].Comment, [qryReceipts&Parts].AnalysisDate,
[qryReceipts&Parts].AnalysisBy, [qryReceipts&Parts].AnalysisComplete,
[qryReceipts&Parts].Symptom

FROM ([qryReceipts&Parts] LEFT JOIN tblRMA ON [qryReceipts&Parts].RMAID =
tblRMA.RMAID) LEFT JOIN tblCustomerInformation ON tblRMA.CustomerID =
tblCustomerInformation.CustomerID;

Thanks again! - jb


Ken Snell said:
Yes, please post the info when you can. I'll monitor this thread.

--
Ken Snell
<MS ACCESS MVP>

steps
can does
not
 
Here is the SQL for the qryReceipts&Parts query : :)

SELECT tblPartsReceipt.BWTagID, tblReceipt.CustomerTagNo, tblReceipt.RMAID,
tblParts.CodeGroup, tblParts.CodeDescription,
IIf([tblPartsReceipt]![DateReceived]>=#8/13/2002#,[PartNumber] &
[tblParts]!
Code:
,[PartNumber]) AS PartNumAndRev, tblParts.Code,
tblPartsReceipt.PartNumberID, tblParts.PartNumber, tblParts.PartDescription,
tblPartsReceipt.PartDateCode, tblPartsReceipt.NewDateCode,
tblPartsReceipt.InserviceDate, tblPartsReceipt.FailureDate,
tblPartsReceipt.InvalidDates, tblPartsReceipt.Mileage,
IIf(IsDate([NewDateCode]) And
IsDate([FailureDate]),DateDiff("d",[NewDateCode],[FailureDate]),IIf(IsDate([
InserviceDate]) And
IsDate([failuredate]),DateDiff("d",[InserviceDate],[FailureDate]),Null)) AS
DaysToFailFromMfg, [DaysToFailFromMfg]/30 AS MonthsToFailFromMfg,
IIf(IsDate([InserviceDate]) And
IsDate([FailureDate]),DateDiff("d",[InserviceDate],[FailureDate]),Null) AS
DaysUntilFailureInservice, [DaysUntilFailureInservice]/30 AS
MonthsToFailureInservice, tblPartsReceipt.PlantReturnQuantity,
tblPartsReceipt.SpecificComplaint, tblPartsReceipt.DateReceived,
tblPartsReceipt.InputBy, tblPartsReceipt.TestPass, tblPartsReceipt.TestFail,
tblFailureClassifications.FailureClassificationCode,
tblFailureSubClass.FailureSubCode, tblPartsReceipt.Result,
tblPartsReceipt.Comment, tblPartsReceipt.CommentOther,
tblPartsReceipt.AnalysisDate, tblPartsReceipt.AnalysisBy,
tblPartsReceipt.AnalysisComplete, tblPartsReceipt.Symptom,
tblPartsReceipt.AnalysisDisp, tblPartsReceipt.AnalysisDispDate,
tblPartsReceipt.Scrapped, tblPartsReceipt.CreditIssued,
tblPartsReceipt.[CA#], tblPartsReceipt.SerialNo,
tblPartsReceipt.PackingSlipNo, tblPartsReceipt.AnalysisDispCompl,
tblPartsReceipt.DispositionDate, tblPartsReceipt.PartsCostsPaid,
tblPartsReceipt.HandlingCostsPaid, tblPartsReceipt.LaborCostsPaid,
tblPartsReceipt.OutsideCostsPaid, tblPartsReceipt.CoreCostsPaid,
tblPartsReceipt.ClaimResponsibility, tblPartsReceipt.AddtlComments,
tblPartsReceipt.FailedPartsDisposition, tblPartsReceipt.DispositionComplete,
tblPartsReceipt.ReceiptID,
IIf([Suffix]="-50","Display",IIf([Suffix]="-52","Module",IIf([Suffix]="-60",
"Fuel Senders",IIf([Suffix]="-62","Sensor","")))) AS AcctType,
IIf([CodeGroup]="Display","-50",IIf([CodeGroup]="Module","-52",IIf([CodeDesc
ription]="Fuel Senders","-60",IIf([CodeGroup]="Sensor","-62")))) AS Suffix,
IIf([CodeGroup]="Display","-50" & [BWResp],IIf([CodeGroup]="Module","-52" &
[BWResp],IIf([CodeDescription]="Fuel Senders","-60" &
[BWResp],IIf([CodeGroup]="Sensor","-62" & [BWResp])))) AS AcctSuffix,
IIf([NewDateCode]=[InserviceDate],"fixed","") AS BWFixDateCode,
IIf([NewDateCode] Is Not Null,[NewDateCode],IIf([InserviceDate] Is Not
Null,[InserviceDate],[DateReceived])) AS CalcDate, IIf([FailureDate] Is
Null,[DateReceived],[FailureDate]) AS CalcFailDate,
IIf([CalcDate]>[CalcFailDate],0,IIf([CalcDate]<=#9/30/2003# And
[CalcFailDate]<=#9/30/2005#,1,IIf([CalcDate]>#9/30/2003#,2,IIf([CalcFailDate
]<=#9/30/2003#,1,0)))) AS Test, IIf([PartNumAndRev]="1",0,1) AS Test2,
IIf([CalcFailDate] Is Null,"-BW","") AS OldIssues,
IIf([OldIssues]="-BW","-BW",IIf([Test]=1 And [Test2]=1,"-BW",IIf([Test]=2
And [Test2]=1,"-MD",""))) AS BWResp, [PartNumAndRev] & [BWResp] AS
[PartNum&Suffix]
FROM tblReceipt INNER JOIN (((tblPartsReceipt LEFT JOIN tblParts ON
tblPartsReceipt.PartNumberID = tblParts.PartNumberID) LEFT JOIN
tblFailureClassifications ON tblPartsReceipt.FailureClassificationID =
tblFailureClassifications.FailureClassificationID) LEFT JOIN
tblFailureSubClass ON tblPartsReceipt.FailureSubClassID =
tblFailureSubClass.FailureSubID) ON tblReceipt.ReceiptID =
tblPartsReceipt.ReceiptID
ORDER BY tblPartsReceipt.BWTagID DESC;

Explanation:  Part of what this query is doing is testing if some of the
dates fall between a certain range.  Based on the outcome, a field in that
record has a designation (suffix) for a particular "company".  Would it help
to see some of the actual data?
-jb

[QUOTE="Ken Snell"]
Please post the SQL of the qryReceipts&Parts query too. Thanks.

--
Ken Snell
<MS  ACCESS MVP>

[QUOTE="JudyB"]
We created the query using design view, and after looking at the SQL
language in the query, I can see that it was created from another query, not
the various tables directly.  Here is the language taken from the SQL view
of the query we are attempting to export to Excel  (I hope this is what you
were referring to):

SELECT [qryReceipts&Parts].BWTagID, tblRMA.CustomerID,
tblCustomerInformation.CustomerName, [qryReceipts&Parts].CustomerTagNo,
[qryReceipts&Parts].RMAID, [qryReceipts&Parts].PartNumberID,
[qryReceipts&Parts].PartNumAndRev, [qryReceipts&Parts].PartDescription,
[qryReceipts&Parts].CodeGroup, [qryReceipts&Parts].CodeDescription,
[qryReceipts&Parts].AcctType, [qryReceipts&Parts].Suffix,
[qryReceipts&Parts].AcctSuffix, [qryReceipts&Parts].NewDateCode,
[qryReceipts&Parts].InserviceDate, [qryReceipts&Parts].FailureDate,
[qryReceipts&Parts].InvalidDates, [qryReceipts&Parts].BWFixDateCode,
[qryReceipts&Parts].BWResp, [qryReceipts&Parts].[PartNum&Suffix],
[qryReceipts&Parts].Mileage, [qryReceipts&Parts].DaysToFailFromMfg,
[qryReceipts&Parts].MonthsToFailFromMfg,
[qryReceipts&Parts].DaysUntilFailureInservice,
[qryReceipts&Parts].MonthsToFailureInservice,
[qryReceipts&Parts].PlantReturnQuantity,
[qryReceipts&Parts].SpecificComplaint, [qryReceipts&Parts].DateReceived,
[qryReceipts&Parts].InputBy, [qryReceipts&Parts].BWTagID,
[qryReceipts&Parts].TestPass, [qryReceipts&Parts].TestFail,
[qryReceipts&Parts].FailureClassificationCode,
[qryReceipts&Parts].FailureSubCode, [qryReceipts&Parts].Result,
[qryReceipts&Parts].Comment, [qryReceipts&Parts].AnalysisDate,
[qryReceipts&Parts].AnalysisBy, [qryReceipts&Parts].AnalysisComplete,
[qryReceipts&Parts].Symptom

FROM ([qryReceipts&Parts] LEFT JOIN tblRMA ON [qryReceipts&Parts].RMAID =
tblRMA.RMAID) LEFT JOIN tblCustomerInformation ON tblRMA.CustomerID =
tblCustomerInformation.CustomerID;

Thanks again! - jb


[QUOTE="Ken Snell"]
Yes, please post the info when you can. I'll monitor this thread.

--
Ken Snell
<MS  ACCESS MVP>

The data we are exporting is actually a query made up of several tables.
All the date fields in the tables are a data type of Date/Time with the
format set as Short Date.  We tried both the Office Links and just
copy/paste to bring the information into Excel.  We get the same results.
If you still need the SQL language for the query, it will be just a couple
days for me to get that (I am not at the same location as the database!).
Thanks in advance for any help!!
JB
Your problem is the reverse of what I usually see....text fields
changing
to
dates.

Please post more info such as the SQL of the query, info about the
table's
fields (format, data content), and how you're doing the export.

--
Ken Snell
<MS  ACCESS MVP>

We have a query which includes several date fields.  When[/QUOTE] exported
to[QUOTE]
Excel
2002, the date fields change to text, and only through several steps
can
be
changed back to date fields for use in pivot tables and other
analysis.
Is
there an easier way to ensure that all date fields come through as
legitimate date fields and stay that way?  We tried turning off the
Error
Checking options in Excel before bringing the data in, but this does
not
help.
[/QUOTE]
[/QUOTE]
[/QUOTE]
 
I don't see anything in the query that would change the date to a text...
Let me clarify what you're seeing:

When you export the query into an EXCEL sheet, the date/time fields' values
are written into cells, and the format of those cells is "Text", not "Date",
when you look at the EXCEL spreadsheet?

How are you doing the export: via manual export (File | Export)? or via
TransferSpreadsheet action in macro or VBA? Or some other way?

Can you email to me an example of the EXCEL file that is created via your
process (remove this is not real from my email address)? And include some
examples of the data (preferably a small example of the database) with the
query. Zip them into a file before emailing them.


--
Ken Snell
<MS ACCESS MVP>

JudyB said:
Here is the SQL for the qryReceipts&Parts query : :)

SELECT tblPartsReceipt.BWTagID, tblReceipt.CustomerTagNo, tblReceipt.RMAID,
tblParts.CodeGroup, tblParts.CodeDescription,
IIf([tblPartsReceipt]![DateReceived]>=#8/13/2002#,[PartNumber] &
[tblParts]!
Code:
,[PartNumber]) AS PartNumAndRev, tblParts.Code,
tblPartsReceipt.PartNumberID, tblParts.PartNumber, tblParts.PartDescription,
tblPartsReceipt.PartDateCode, tblPartsReceipt.NewDateCode,
tblPartsReceipt.InserviceDate, tblPartsReceipt.FailureDate,
tblPartsReceipt.InvalidDates, tblPartsReceipt.Mileage,
IIf(IsDate([NewDateCode]) And
 IsDate([FailureDate]),DateDiff("d",[NewDateCode],[FailureDate]),IIf(IsDate([
InserviceDate]) And
IsDate([failuredate]),DateDiff("d",[InserviceDate],[FailureDate]),Null)) AS
DaysToFailFromMfg, [DaysToFailFromMfg]/30 AS MonthsToFailFromMfg,
IIf(IsDate([InserviceDate]) And
IsDate([FailureDate]),DateDiff("d",[InserviceDate],[FailureDate]),Null) AS
DaysUntilFailureInservice, [DaysUntilFailureInservice]/30 AS
MonthsToFailureInservice, tblPartsReceipt.PlantReturnQuantity,
tblPartsReceipt.SpecificComplaint, tblPartsReceipt.DateReceived,
tblPartsReceipt.InputBy, tblPartsReceipt.TestPass, tblPartsReceipt.TestFail,
tblFailureClassifications.FailureClassificationCode,
tblFailureSubClass.FailureSubCode, tblPartsReceipt.Result,
tblPartsReceipt.Comment, tblPartsReceipt.CommentOther,
tblPartsReceipt.AnalysisDate, tblPartsReceipt.AnalysisBy,
tblPartsReceipt.AnalysisComplete, tblPartsReceipt.Symptom,
tblPartsReceipt.AnalysisDisp, tblPartsReceipt.AnalysisDispDate,
tblPartsReceipt.Scrapped, tblPartsReceipt.CreditIssued,
tblPartsReceipt.[CA#], tblPartsReceipt.SerialNo,
tblPartsReceipt.PackingSlipNo, tblPartsReceipt.AnalysisDispCompl,
tblPartsReceipt.DispositionDate, tblPartsReceipt.PartsCostsPaid,
tblPartsReceipt.HandlingCostsPaid, tblPartsReceipt.LaborCostsPaid,
tblPartsReceipt.OutsideCostsPaid, tblPartsReceipt.CoreCostsPaid,
tblPartsReceipt.ClaimResponsibility, tblPartsReceipt.AddtlComments,
tblPartsReceipt.FailedPartsDisposition, tblPartsReceipt.DispositionComplete,[QUOTE]
tblPartsReceipt.ReceiptID,
[/QUOTE]
IIf([Suffix]="-50","Display",IIf([Suffix]="-52","Module",IIf([Suffix]="-60",
"Fuel Senders",IIf([Suffix]="-62","Sensor","")))) AS AcctType,
 IIf([CodeGroup]="Display","-50",IIf([CodeGroup]="Module","-52",IIf([CodeDesc
ription]="Fuel Senders","-60",IIf([CodeGroup]="Sensor","-62")))) AS Suffix,
IIf([CodeGroup]="Display","-50" & [BWResp],IIf([CodeGroup]="Module","-52" &
[BWResp],IIf([CodeDescription]="Fuel Senders","-60" &
[BWResp],IIf([CodeGroup]="Sensor","-62" & [BWResp])))) AS AcctSuffix,
IIf([NewDateCode]=[InserviceDate],"fixed","") AS BWFixDateCode,
IIf([NewDateCode] Is Not Null,[NewDateCode],IIf([InserviceDate] Is Not
Null,[InserviceDate],[DateReceived])) AS CalcDate, IIf([FailureDate] Is
Null,[DateReceived],[FailureDate]) AS CalcFailDate,
IIf([CalcDate]>[CalcFailDate],0,IIf([CalcDate]<=#9/30/2003# And
[/QUOTE]
[QUOTE]
]<=#9/30/2003#,1,0)))) AS Test, IIf([PartNumAndRev]="1",0,1) AS Test2,
IIf([CalcFailDate] Is Null,"-BW","") AS OldIssues,
IIf([OldIssues]="-BW","-BW",IIf([Test]=1 And [Test2]=1,"-BW",IIf([Test]=2
And [Test2]=1,"-MD",""))) AS BWResp, [PartNumAndRev] & [BWResp] AS
[PartNum&Suffix]
FROM tblReceipt INNER JOIN (((tblPartsReceipt LEFT JOIN tblParts ON
tblPartsReceipt.PartNumberID = tblParts.PartNumberID) LEFT JOIN
tblFailureClassifications ON tblPartsReceipt.FailureClassificationID =
tblFailureClassifications.FailureClassificationID) LEFT JOIN
tblFailureSubClass ON tblPartsReceipt.FailureSubClassID =
tblFailureSubClass.FailureSubID) ON tblReceipt.ReceiptID =
tblPartsReceipt.ReceiptID
ORDER BY tblPartsReceipt.BWTagID DESC;

Explanation:  Part of what this query is doing is testing if some of the
dates fall between a certain range.  Based on the outcome, a field in that
record has a designation (suffix) for a particular "company".  Would it help
to see some of the actual data?
-jb

[QUOTE="Ken Snell"]
Please post the SQL of the qryReceipts&Parts query too. Thanks.

--
Ken Snell
<MS  ACCESS MVP>

[QUOTE="JudyB"]
We created the query using design view, and after looking at the SQL
language in the query, I can see that it was created from another[/QUOTE] query,
not[QUOTE]
the various tables directly.  Here is the language taken from the SQL view
of the query we are attempting to export to Excel  (I hope this is[/QUOTE] what
you[QUOTE]
were referring to):

SELECT [qryReceipts&Parts].BWTagID, tblRMA.CustomerID,
tblCustomerInformation.CustomerName, [qryReceipts&Parts].CustomerTagNo,
[qryReceipts&Parts].RMAID, [qryReceipts&Parts].PartNumberID,
[qryReceipts&Parts].PartNumAndRev, [qryReceipts&Parts].PartDescription,
[qryReceipts&Parts].CodeGroup, [qryReceipts&Parts].CodeDescription,
[qryReceipts&Parts].AcctType, [qryReceipts&Parts].Suffix,
[qryReceipts&Parts].AcctSuffix, [qryReceipts&Parts].NewDateCode,
[qryReceipts&Parts].InserviceDate, [qryReceipts&Parts].FailureDate,
[qryReceipts&Parts].InvalidDates, [qryReceipts&Parts].BWFixDateCode,
[qryReceipts&Parts].BWResp, [qryReceipts&Parts].[PartNum&Suffix],
[qryReceipts&Parts].Mileage, [qryReceipts&Parts].DaysToFailFromMfg,
[qryReceipts&Parts].MonthsToFailFromMfg,
[qryReceipts&Parts].DaysUntilFailureInservice,
[qryReceipts&Parts].MonthsToFailureInservice,
[qryReceipts&Parts].PlantReturnQuantity,
[qryReceipts&Parts].SpecificComplaint, [qryReceipts&Parts].DateReceived,
[qryReceipts&Parts].InputBy, [qryReceipts&Parts].BWTagID,
[qryReceipts&Parts].TestPass, [qryReceipts&Parts].TestFail,
[qryReceipts&Parts].FailureClassificationCode,
[qryReceipts&Parts].FailureSubCode, [qryReceipts&Parts].Result,
[qryReceipts&Parts].Comment, [qryReceipts&Parts].AnalysisDate,
[qryReceipts&Parts].AnalysisBy, [qryReceipts&Parts].AnalysisComplete,
[qryReceipts&Parts].Symptom

FROM ([qryReceipts&Parts] LEFT JOIN tblRMA ON[/QUOTE][/QUOTE] [qryReceipts&Parts].RMAID[QUOTE]
= with
the[/QUOTE] through[QUOTE]
as off
the this
does
[/QUOTE]
[/QUOTE]
 
An interesting occurrence! I've worked a bit with the EXCEL and ACCESS files
that you sent to me.

When I open the EXCEL file with EXCEL 2002, I see that the different fields
have the indicator triangles stating that the numbers and dates are stored
as text, even though the cells' formats are not set to text format.

Did some experimenting:

(1) Using File | Export option from database window, if I choose EXCEL 97 -
2000 format for exported file, and check the "Save As Formatted" option, the
file that I create has the numbers and dates in correct "number" or "date"
formats; they're not changed to text except for those in the columns where
you have a mixture of pure numeric numbers and alphanumeric characters (such
as Expr1000, the first column). [NOTE: if the query is filtered in the
datasheet view, and you leave it open and then perform the File | Export
option, only the filtered records are exported; not the entire query.]

(2) Using File | Export option from database window, if I choose EXCEL 97 -
2000 format for exported file, and do not check the "Save As Formatted"
option, the file that I create has the same characteristics as the one in
(1). [NOTE: if the query is filtered in the datasheet view, and you leave
it open and then perform the File | Export option, only the filtered records
are exported; not the entire query.]

(3) Using Copy and Paste from datasheet view of the query into blank sheet
of EXCEL workbook, the dates are not formatted as text, but the numbers are
stored as text. I even tried copying just the field from just a few records,
and pasting into an empty sheet; EXCEL still formats them as text (I even
reformatted the queries' fields for this field to be General Number; same
result).

(4) I wrote a macro with one action in it: TransferSpreadsheet. I used
this macro to export the query into an EXCEL file. Numbers and dates were
not inappropriately converted to text. [NOTE: even if the query is filtered
in the datasheet view, and you leave it open and then run the macro, the
entire query is exported; not just the filtered records.This obviously will
not work for your query that has over 17 million records in it.]

Thus, based on my testing, I recommend that the query be open in the
datasheet view, that it be filtered to the the desired records, and that the
File | Export option be used (note that this option has limitations of
record width and number of records (no more than 16,000 or so records;
whatever the limitation of Excel 97 is for length of a spreadsheet).

Your other option would be to create a form that allows the query to be
filtered as desired, and then to use a command button on the form to export
just the desired records into an EXCEL sheet.

--
Ken Snell
<MS ACCESS MVP>

Ken Snell said:
I don't see anything in the query that would change the date to a text...
Let me clarify what you're seeing:

When you export the query into an EXCEL sheet, the date/time fields' values
are written into cells, and the format of those cells is "Text", not "Date",
when you look at the EXCEL spreadsheet?

How are you doing the export: via manual export (File | Export)? or via
TransferSpreadsheet action in macro or VBA? Or some other way?

Can you email to me an example of the EXCEL file that is created via your
process (remove this is not real from my email address)? And include some
examples of the data (preferably a small example of the database) with the
query. Zip them into a file before emailing them.


--
Ken Snell
<MS ACCESS MVP>

JudyB said:
Here is the SQL for the qryReceipts&Parts query : :)

SELECT tblPartsReceipt.BWTagID, tblReceipt.CustomerTagNo, tblReceipt.RMAID,
tblParts.CodeGroup, tblParts.CodeDescription,
IIf([tblPartsReceipt]![DateReceived]>=#8/13/2002#,[PartNumber] &
[tblParts]!
Code:
,[PartNumber]) AS PartNumAndRev, tblParts.Code,
tblPartsReceipt.PartNumberID, tblParts.PartNumber, tblParts.PartDescription,
tblPartsReceipt.PartDateCode, tblPartsReceipt.NewDateCode,
tblPartsReceipt.InserviceDate, tblPartsReceipt.FailureDate,
tblPartsReceipt.InvalidDates, tblPartsReceipt.Mileage,
IIf(IsDate([NewDateCode]) And
 [/QUOTE]
IsDate([FailureDate]),DateDiff("d",[NewDateCode],[FailureDate]),IIf(IsDate([[QUOTE]
InserviceDate]) And
IsDate([failuredate]),DateDiff("d",[InserviceDate],[FailureDate]),Null)) AS
DaysToFailFromMfg, [DaysToFailFromMfg]/30 AS MonthsToFailFromMfg,
IIf(IsDate([InserviceDate]) And
IsDate([FailureDate]),DateDiff("d",[InserviceDate],[FailureDate]),Null) AS
DaysUntilFailureInservice, [DaysUntilFailureInservice]/30 AS
MonthsToFailureInservice, tblPartsReceipt.PlantReturnQuantity,
tblPartsReceipt.SpecificComplaint, tblPartsReceipt.DateReceived,
tblPartsReceipt.InputBy, tblPartsReceipt.TestPass, tblPartsReceipt.TestFail,
tblFailureClassifications.FailureClassificationCode,
tblFailureSubClass.FailureSubCode, tblPartsReceipt.Result,
tblPartsReceipt.Comment, tblPartsReceipt.CommentOther,
tblPartsReceipt.AnalysisDate, tblPartsReceipt.AnalysisBy,
tblPartsReceipt.AnalysisComplete, tblPartsReceipt.Symptom,
tblPartsReceipt.AnalysisDisp, tblPartsReceipt.AnalysisDispDate,
tblPartsReceipt.Scrapped, tblPartsReceipt.CreditIssued,
tblPartsReceipt.[CA#], tblPartsReceipt.SerialNo,
tblPartsReceipt.PackingSlipNo, tblPartsReceipt.AnalysisDispCompl,
tblPartsReceipt.DispositionDate, tblPartsReceipt.PartsCostsPaid,
tblPartsReceipt.HandlingCostsPaid, tblPartsReceipt.LaborCostsPaid,
tblPartsReceipt.OutsideCostsPaid, tblPartsReceipt.CoreCostsPaid,
tblPartsReceipt.ClaimResponsibility, tblPartsReceipt.AddtlComments,
tblPartsReceipt.FailedPartsDisposition, tblPartsReceipt.DispositionComplete,[QUOTE]
tblPartsReceipt.ReceiptID,
[/QUOTE]
[/QUOTE]
IIf([Suffix]="-50","Display",IIf([Suffix]="-52","Module",IIf([Suffix]="-60",[QUOTE]
"Fuel Senders",IIf([Suffix]="-62","Sensor","")))) AS AcctType,
 [/QUOTE]
IIf([CodeGroup]="Display","-50",IIf([CodeGroup]="Module","-52",IIf([CodeDesc[QUOTE]
ription]="Fuel Senders","-60",IIf([CodeGroup]="Sensor","-62")))) AS Suffix,
IIf([CodeGroup]="Display","-50" &[/QUOTE] [BWResp],IIf([CodeGroup]="Module","-52"[QUOTE]
&
[BWResp],IIf([CodeDescription]="Fuel Senders","-60" &
[BWResp],IIf([CodeGroup]="Sensor","-62" & [BWResp])))) AS AcctSuffix,
IIf([NewDateCode]=[InserviceDate],"fixed","") AS BWFixDateCode,
IIf([NewDateCode] Is Not Null,[NewDateCode],IIf([InserviceDate] Is Not
Null,[InserviceDate],[DateReceived])) AS CalcDate, IIf([FailureDate] Is
Null,[DateReceived],[FailureDate]) AS CalcFailDate,
IIf([CalcDate]>[CalcFailDate],0,IIf([CalcDate]<=#9/30/2003# And
 [/QUOTE]
[QUOTE]
]<=#9/30/2003#,1,0)))) AS Test, IIf([PartNumAndRev]="1",0,1) AS Test2,
IIf([CalcFailDate] Is Null,"-BW","") AS OldIssues,
IIf([OldIssues]="-BW","-BW",IIf([Test]=1 And [Test2]=1,"-BW",IIf([Test]=2
And [Test2]=1,"-MD",""))) AS BWResp, [PartNumAndRev] & [BWResp] AS
[PartNum&Suffix]
FROM tblReceipt INNER JOIN (((tblPartsReceipt LEFT JOIN tblParts ON
tblPartsReceipt.PartNumberID = tblParts.PartNumberID) LEFT JOIN
tblFailureClassifications ON tblPartsReceipt.FailureClassificationID =
tblFailureClassifications.FailureClassificationID) LEFT JOIN
tblFailureSubClass ON tblPartsReceipt.FailureSubClassID =
tblFailureSubClass.FailureSubID) ON tblReceipt.ReceiptID =
tblPartsReceipt.ReceiptID
ORDER BY tblPartsReceipt.BWTagID DESC;

Explanation:  Part of what this query is doing is testing if some of the
dates fall between a certain range.  Based on the outcome, a field in that
record has a designation (suffix) for a particular "company".  Would it help
to see some of the actual data?
-jb

[QUOTE="Ken Snell"]
Please post the SQL of the qryReceipts&Parts query too. Thanks.

--
Ken Snell
<MS  ACCESS MVP>

We created the query using design view, and after looking at the SQL
language in the query, I can see that it was created from another query,
not
the various tables directly.  Here is the language taken from the[/QUOTE] SQL
view[QUOTE]
of the query we are attempting to export to Excel  (I hope this is what
you
were referring to):

SELECT [qryReceipts&Parts].BWTagID, tblRMA.CustomerID,
tblCustomerInformation.CustomerName, [qryReceipts&Parts].CustomerTagNo,
[qryReceipts&Parts].RMAID, [qryReceipts&Parts].PartNumberID,
[qryReceipts&Parts].PartNumAndRev, [qryReceipts&Parts].PartDescription,
[qryReceipts&Parts].CodeGroup, [qryReceipts&Parts].CodeDescription,
[qryReceipts&Parts].AcctType, [qryReceipts&Parts].Suffix,
[qryReceipts&Parts].AcctSuffix, [qryReceipts&Parts].NewDateCode,
[qryReceipts&Parts].InserviceDate, [qryReceipts&Parts].FailureDate,
[qryReceipts&Parts].InvalidDates, [qryReceipts&Parts].BWFixDateCode,
[qryReceipts&Parts].BWResp, [qryReceipts&Parts].[PartNum&Suffix],
[qryReceipts&Parts].Mileage, [qryReceipts&Parts].DaysToFailFromMfg,
[qryReceipts&Parts].MonthsToFailFromMfg,
[qryReceipts&Parts].DaysUntilFailureInservice,
[qryReceipts&Parts].MonthsToFailureInservice,
[qryReceipts&Parts].PlantReturnQuantity,
[qryReceipts&Parts].SpecificComplaint, [qryReceipts&Parts].DateReceived,
[qryReceipts&Parts].InputBy, [qryReceipts&Parts].BWTagID,
[qryReceipts&Parts].TestPass, [qryReceipts&Parts].TestFail,
[qryReceipts&Parts].FailureClassificationCode,
[qryReceipts&Parts].FailureSubCode, [qryReceipts&Parts].Result,
[qryReceipts&Parts].Comment, [qryReceipts&Parts].AnalysisDate,
[qryReceipts&Parts].AnalysisBy, [qryReceipts&Parts].AnalysisComplete,
[qryReceipts&Parts].Symptom

FROM ([qryReceipts&Parts] LEFT JOIN tblRMA ON[/QUOTE] [qryReceipts&Parts].RMAID[QUOTE]
=
tblRMA.RMAID) LEFT JOIN tblCustomerInformation ON tblRMA.CustomerID =
tblCustomerInformation.CustomerID;

Thanks again! - jb


Yes, please post the info when you can. I'll monitor this thread.

--
Ken Snell
<MS  ACCESS MVP>

The data we are exporting is actually a query made up of several
tables.
All the date fields in the tables are a data type of Date/Time with
the
format set as Short Date.  We tried both the Office Links and just
copy/paste to bring the information into Excel.  We get the same
results.
If you still need the SQL language for the query, it will be[/QUOTE][/QUOTE] just[QUOTE]
a through
[/QUOTE]
[/QUOTE]
 
Back
Top