X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Specifying Criteria On The Fly For A Query Export, Access 2013    
post Dec 22 2017, 03:36 PM

Posts: 166
Joined: 9-May 11
From: Columbus, GA USA

Hey forum! Could use some help with this question.

My project has a query that produces a list of records that the database exports to an Excel spreadsheet using the RunSavedImportExport method. Up til now the query did not include any criteria. Now, the users want to apply date criteria to the query before the export takes place. I'm looking for a way to apply the user's selected dates as criteria for the query export. The user's form contains unbound text boxes for the start and end dates and a command button to execute the RunSavedImportExport. The dates should be applied as follows: Start Date only should be "[WODate]>= Start Date", Finish Date Only should be "[WODate]<=End Date", and both dates should be "[WODate]>=Start Date and [WODate]<=End Date".

Any ideas or suggestion on how I might implement this will be greatly appreciated!

Go to the top of the page
post Dec 22 2017, 03:44 PM

UtterAccess Editor
Posts: 18,252
Joined: 29-March 05
From: Wisconsin


First, you should rename your textboxes so they are at least different from the field name. Having a field named "Start Date" AND an unbound textbox with the same name is asking for trouble. Maybe "txtStartDate" and "txtEndDate". In fact, I would recommend removing spaces from all object names when you have the chance, because spaces can cause problems with queries and code.

Second, the query just needs to reference the form and the controls along these lines:

WHERE [Start Date] >= [Forms]![frmExportData]![txtStartDate] And [Start Date] <= [Forms]![frmExportData]![txtEndDate];

Hope this helps,


(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    19th April 2018 - 12:37 PM