UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Exporting Query To Excel File, Office 2007    
 
   
pclutts
post Mar 29 2012, 03:19 PM
Post #1

UtterAccess Veteran
Posts: 461
From: Austin, TX



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.
Go to the top of the page
 
+
theDBguy
post Mar 29 2012, 03:24 PM
Post #2

Access Wiki and Forums Moderator
Posts: 48,617
From: SoCal, USA



Hi Paul,

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... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
kapeller
post Mar 29 2012, 03:29 PM
Post #3

UtterAccess VIP
Posts: 2,630
From: Melbourne Australia Down Under



Hi Paul

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
Go to the top of the page
 
+
pclutts
post Mar 30 2012, 09:18 AM
Post #4

UtterAccess Veteran
Posts: 461
From: Austin, TX



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.
Go to the top of the page
 
+
kapeller
post Mar 30 2012, 04:27 PM
Post #5

UtterAccess VIP
Posts: 2,630
From: Melbourne Australia Down Under



Hi Paul

Take a look at this

Link
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 12:20 PM