Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Error when importing external data from Access

This is a very strange one, that i hope will be an enjoyable challenge to
someone!

I am trying to import data from a query i have made in Access (2003) into a
new worksheet in Excel (2003).

When running the query in Access, column "TE2" shows the correct data.
However, when i import this query into Excel, the same column shows incorrect
data and seems to duplicating whatever data is shown in the column to the
left - "TE1".

The SQL is witten as follows, if it helps:

"SELECT tblDates.Date, 1440-IIf(IsNull([1-TPT]),0,[1-TPT]) AS TPT,
1440-IIf(IsNull([1-NPT]),0,[1-NPT]) AS NPT,
((1440-IIf(IsNull([1-NPT]),0,[1-NPT]))/1440)*100 AS TE1,
IIf(((1440-IIf(IsNull([1-TPT]),0,[1-TPT]))=0),0,((1440-IIf(IsNull([1-NPT]),0,[1-NPT]))/(1440-IIf(IsNull([1-TPT]),0,[1-TPT])))*100)
AS TE2, tblDates.TE1_Target, tblDates.TE2_Target
FROM (tblDates LEFT JOIN qryNPTbyDay ON tblDates.Date = qryNPTbyDay.Date)
LEFT JOIN qryTPTbyDay ON tblDates.Date = qryTPTbyDay.Date
WHERE (((tblDates.Date) Between Now()-29 And Now()-1));"

My feeling is that it is something to do with the changing of Null results
to zeros because when i used the code "Nz" i couldn't even pick the query
from the list when importing into Excel.

I would really appreciate some help with this

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default Error when importing external data from Access

When you say "import this query into Excel", what are you importing? Are you
using Excel's MS Query tool to run the Access query? Or are you copying and
pasting the query data into an Excel spreadsheet?

If it's the latter that's causing you a problem maybe try to use the MS
Query tool (Data--Import External Data--New Database Query) to trigger the
query in the MS Access db....

Dave
--
Brevity is the soul of wit.


"Stephen Jame Pattenden" wrote:

This is a very strange one, that i hope will be an enjoyable challenge to
someone!

I am trying to import data from a query i have made in Access (2003) into a
new worksheet in Excel (2003).

When running the query in Access, column "TE2" shows the correct data.
However, when i import this query into Excel, the same column shows incorrect
data and seems to duplicating whatever data is shown in the column to the
left - "TE1".

The SQL is witten as follows, if it helps:

"SELECT tblDates.Date, 1440-IIf(IsNull([1-TPT]),0,[1-TPT]) AS TPT,
1440-IIf(IsNull([1-NPT]),0,[1-NPT]) AS NPT,
((1440-IIf(IsNull([1-NPT]),0,[1-NPT]))/1440)*100 AS TE1,
IIf(((1440-IIf(IsNull([1-TPT]),0,[1-TPT]))=0),0,((1440-IIf(IsNull([1-NPT]),0,[1-NPT]))/(1440-IIf(IsNull([1-TPT]),0,[1-TPT])))*100)
AS TE2, tblDates.TE1_Target, tblDates.TE2_Target
FROM (tblDates LEFT JOIN qryNPTbyDay ON tblDates.Date = qryNPTbyDay.Date)
LEFT JOIN qryTPTbyDay ON tblDates.Date = qryTPTbyDay.Date
WHERE (((tblDates.Date) Between Now()-29 And Now()-1));"

My feeling is that it is something to do with the changing of Null results
to zeros because when i used the code "Nz" i couldn't even pick the query
from the list when importing into Excel.

I would really appreciate some help with this

Thanks in advance

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing EXCEL Spreadsheets into ACCESS -- Macro or VBA? Excel Discussion (Misc queries) 0 July 12th 06 10:08 PM
MONTHNAME when getting external data from Access -PJ Excel Worksheet Functions 2 June 30th 06 08:50 PM
Problem importing data from Access BT Connect Excel Discussion (Misc queries) 2 January 21st 06 04:07 PM
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
Importing Data from an Access Database Including a Hyperlink Colum B.C.Lioness Excel Discussion (Misc queries) 0 May 16th 05 05:26 PM


All times are GMT +1. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"