Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make new table

Status
Not open for further replies.

M8KWR

Programmer
Aug 18, 2004
864
GB
Hi there, What i have is a query, which have a field called SOURCE, is this there can be anything from 2-6 different value.

what i require is to export this to excel, but create a new sheet for each different value in the source fields.

I know how to export this to excel via code, but i always thought that access used the name of the table/query for the sheet name.

What i was thinking was to create a loop which created the tables, and then export them to a certain excel file/path, adn then the name of the table/query would be the name of the sheet within excel.

I know i could create a query for each value in the source field, but these value could change, and i'm tryin to work out a procedure that is dynamic.

I hope i have explained myself ok, if not please let me know.
 

In VBA, create a recordset to retrieve all values of this field. Loop till the rs.EOF and for each value use a special query in the database. That query should be exporting all records of the table the way you like (formating, ordering, etc).Grab the sql of the query add a WHERE clause filtering for the value of the recordset and then export that query!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top