Comman Button

D

Denver

hi,

I have a form with a subfrom [DCL_MasterlList2] with a SQL record source
SELECT [Data Entry2].[Site ID], [Data Entry2].[Site Name], [Data
Entry2].[Drawing Ref], [Data Entry2].[Sheet No], [Data Entry2].Rev, [Data
Entry2].Description, [Data Entry2].[Drwg Typ], [Data Entry2].[Drawing Title],
[Data Entry2].[Rd Line], [Data Entry2].[TR Rd Line], [Data Entry2].[TR Rd
Line Date], [Data Entry2].ReSubmit, [Data Entry2].[Date ReSubmit], [Data
Entry2].AsBuilt, [Data Entry2].[Reviewed Red Line], [Data Entry2].[Reviewed
Red Line(PMT)], [Data Entry2].[TR Rd Line(PMT)], [Data Entry2].[TR Rd
Line(PMT) Date], [Data Entry2].[Return by PMT], [Data Entry2].[Date Return],
[Data Entry2].SubContractor, [Data Entry2].CWP, [Data Entry2].[CWP Title],
[Data Entry2].Index, [Data Entry2].Discipline, [Data Entry2].Prefix, [Data
Entry2].Size, [Data Entry2].size_value, [Data Entry2].[Qty of Sheets], [Data
Entry2].EQA, [Data Entry2].EA, [Data Entry2].Eqv_A_Size, [Data
Entry2].[Earned ASize], [Data Entry2].[Physical Prog], [Data Entry2].TR,
[Data Entry2].Date, [Data Entry2].SubCon, [Data Entry2].Location, [Data
Entry2].[Drawing Control No], [Data Entry2].[Key Drawing],......FROM [Data
Entry2];

I have a cmdCreateList button, I want from this button that after I make
filter
from my subform and click on cmdCreateList it will export those filter to
excel 2003 with only the following form Column

Drawing No. Site Rev Index Description

Is it possible? because my subform consist of around 15 columns so rather
than exporting everything i just need to export those columns.

How would i start my codes? i am using access 2003

thanks for any help, I appreciate
 
T

Tom van Stiphout

On Fri, 10 Jul 2009 00:13:01 -0700, Denver

I don't know of a simple way to do that, but I do know of a
complicated way. It all ends with DoCmd.TransferSpreadsheet, which is
great and fast for outputting data to Excel. You can give it any
query, for example one with those 5 columns, conceptually:
select [my five columns]
from myTable

But how to filter to what you have filtered on the subform? To do that
I would use a "temp" table that I would first clear out and then fill
with the primary key information of the filtered rows. You can do that
with VBA, by iterating over the RecordsetClone of the subform.
Then I would inner-join my previous query with this table, and it
would automatically restrict the output to those records that are in
the temp table (and thus that were in your subform).

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Subform 0
Yes/No Field 2
return without gosub error 0
return without gosub error 0
create List Button 1
linking data from a web to access 6
newbie trying to use data access web page (Access 2003) 0
XML Parsing 1

Top