PDA

View Full Version : Apply filter when export data to excel file



ViolettePhan
06-26-2006, 09:36 PM
Hi all
I have a form search frmSearch, after search it call frmAddressSummary with the list of address that meet my criteria, from this frmAddressSummary, i have 2 command button to print report and print mail labels (they are working well with strWhere filter), and I I try 1 command button to call frmExport (with option to export to excel, access or csv format) I would like to know how do I code so that I can use the filter from frmAddressSummary eventhough I'm in frmExport?
Thanks in advance...
Violette

OBP
06-27-2006, 09:28 AM
The simplest way that I know of sharing filters between forms and reports etc is to not use query by form, but to have the filter in the Query's Criteria. This means that any other object using the query gets the same filtering.
To do this you would use something like
Forms![frmSearch]![searchaddress]
in the criteria row for the Address Column
where [searchaddress] is the search field on your form.
You can have as many search fields as you have fields in your query.
This will also allow Pattern Matching with the
like "*" & Forms![frmSearch]![searchaddress] & "*"
which is very useful.
ps I haven't forgotten your other post, I just haven't had a chance to look at it today.

ViolettePhan
06-27-2006, 09:58 AM
Hi OBP,

Thanks for reply, I will try and see if it work with docmd.transferspreadsheet after my porject demo.

Thanks for not forget my other post...
I'm appreciated your help and time...
Best,
Violette

OBP
06-29-2006, 07:21 AM
Sorry Wrong thread.