> The Excel 8.0 shouldn't be a problem - it's what I use in Access 2003.
>
[quoted text clipped - 79 lines]
>
> Please respond in the newgroup and not by email.
The obvious problem is in this statement
> 'Assemble the SQL query to export one agency
> strSQL = SQL1 & strFilespec & ";] " & SQL2 & lngAgencyID & ";"
You're not providing a worksheet name, and you have to do so. In my
original post I said
> 'Assemble the SQL query to export one agency
> strSQL = SQL1 & strFilespec & ";].[" & strSheet _
> & SQL2 & lngAgencyID & ";"
having previously set
> strSheet = CStr(lngAgencyID)
but you could equally use a constant name, e.g.
strSheet = "Sheet1"
>heres my code-
>
[quoted text clipped - 121 lines]
>>
>> Please respond in the newgroup and not by email.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
AmyNeedsHelp - 21 Sep 2005 17:44 GMT
ok, I used the sql query you had in the original post and it gave me a syntax
error, this is what the statement looked like in the immediate window
SELECT * INTO [Excel
8.0;HDR=Yes;Database=U:\AmyS\GroupReports\testFile.xls;].[78FROM orderData
WHERE AgencyID=78;
which the sheet part looked funny to me and i thought maybe it was not
needed so i took that part out- however i figured it out now, thank you so
much, its very neat how stuff works- thanks again!!
> The obvious problem is in this statement
>
[quoted text clipped - 143 lines]
>
> Please respond in the newgroup and not by email.
John Nurick - 21 Sep 2005 18:21 GMT
Glad you worked it out. What I originally posted wrote was "air code",
written rapidly into the message and never tested.
> ok, I used the sql query you had in the original post and it gave me a
> syntax
[quoted text clipped - 7 lines]
> needed so i took that part out- however i figured it out now, thank you so
> much, its very neat how stuff works- thanks again!!
AmyNeedsHelp - 21 Sep 2005 18:43 GMT
Hi-
i actually have another question, but not sure if its even possible to do-
i have some records that are the same all the way through except one field.
ex. field names: ordernumber name btn feature
ex. values: 123456789 jane 1234567890 call waiting
123456789 jane 1234567890 call forwarding
what they want in the excel sheet is this
ordernumber name btn feature
123456789 jane 1234567890 call waiting --- call forwarding
so it combines the records sort of, i was thinking of testing to see if
those fields that are the same to see if there are the same as it goes
through the loop and then if they are then concatenate the last field value
to the previous record field value, does that sound right or is there a
better way???
> Glad you worked it out. What I originally posted wrote was "air code",
> written rapidly into the message and never tested.
[quoted text clipped - 10 lines]
> > needed so i took that part out- however i figured it out now, thank you so
> > much, its very neat how stuff works- thanks again!!
John Nurick - 21 Sep 2005 20:31 GMT
Hi Amy,
It can be done. Get the fConcatFld() function from
http://www.mvps.org/access/modules/mdl0008.htm
and paste it into a module in your database. Then modify the code you
already have so that the queries you build include a calculated field
that calls fConcatFld().
Here's an example from my test database of a finished query:
SELECT
Firstname,
fConcatFld("AddrNew", "FirstName", "LastName", "String",
[FirstName]) AS Surnames
INTO [Excel 8.0;HDR=Yes;Database=C:\Temp\TestConcat.xls;].[Sheet1]
FROM AddrNew
WHERE City="London";
With your example field names, it would be more like
fConcatFld("AmysTable", "ordernumber", "feature", "Long",
[ordernumber]) AS Features
>Hi-
>
[quoted text clipped - 31 lines]
>> > needed so i took that part out- however i figured it out now, thank you so
>> > much, its very neat how stuff works- thanks again!!
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.