View Single Post
 
Old June 5th, 2007, 11:34 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am sure there is a more elegant way to do this, but my presumption is that you cannot export to excel from any dynamic query, it must come from a saved query or a table.

What I do is create a table that holds all the fields in my query, then create a delete query to empty the table, then create an append query to push new records into the empty table, then export the table to Excel.

In your case, you would create an Append query seperate from your subform, and then in the criteria lines for ProductType and Supplier, add:

[Forms]![myFormWithSubForm].[cmbSupplierList]
[Forms]![myFormWithSubForm].[cmbProductTypes]

No need to specify Column(0) since that should be the bound column anyway.

DoCmd.SetWarnings False
DoCmd.OpenQuery "qryDELETETempTable"
DoCmd.OpenQuery "qryAPPENDTempTable"
DoCmd.SetWarnings True
DoCmd.... export to excel here

Did that help?









mmcdonal