Mar 29 2012, 03:19 PM
I have a query (qryConstInsp) that is launched by a command button that has been working well. One of the fields in the query (dateofinsp) has a date prompter in the criteria shown below.
Between [Forms]![frmConstInsp]![txtStartDate] And [Forms]![frmConstInsp]![txtEndDate]
Once the user provides the dates for the prompter and then creates the query datasheet, I would like the system to automatically show a pop up message (form) that asks if the user would like to export the datasheet to an Excel file. The choices on the pop up would be Yes and No. If yes, the data on the query would be exported to an Excel file at a location of the user's choosing. if no, then the pop up message would go away.
Could anyone help me to create this feature? Thanks in advance for your time.
Mar 29 2012, 03:24 PM
We highly recommend not exposing the actual query to the user. In any case, in your command button to open the query, you should be able to add a MsgBox to ask the user if they want to export the query or not.
Just my 2 cents...
Mar 29 2012, 03:29 PM
Hope you do not mind me jumping in theDBGuy
Attached is an example with two methods that allows the user to define a date range criteria and as advised by theDBguy keeps the user away from the query.Excel Example
Hope this helps
Mar 30 2012, 09:18 AM
I just finished looking at your example database. Shouldn't the startdate and enddate be included as part of the query criteria? I tried different dates on the form, and it didn't seem to make a difference in the results. Thanks a bunch for sharing, because I can use the code.