Re: OutputTo: Path Name Using [Forms]!

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Steve Schapel (schapel_at_mvps.org.ns)
Date: 03/23/05


Date: Wed, 23 Mar 2005 20:28:50 +1200

AZ,

You are opening the 1199563 form via th macro, which presumably doesn't
allow the user to enter the applicable date in the PROCESSDAT textbox,
so I can't quite see how that works. And then, the object nominated for
output is the 1199563 form? This is odd. As far as I know, you can't
really export a form to an Excel file, can you? I would have expected
the Object Type argument to be Query, and the Object Name to be the name
of a query.

-- 
Steve Schapel, Microsoft Access MVP
AZ Analog wrote:
> Thank you for your help Mr. Schapel,
> I do have a form named 1199563 and there is a control on it containing the 
> date by which the query is run.
> 
> The macro isn't called from anything yet, except through running the macro 
> through the macro window.  Future plans for this macro will be run through a 
> Command button. The macro that I'm creating is a simple and repetitive 
> OutputTo.  Basically, it's 43 lines of OutputTo.  Each line run's it's query 
> and exports to excel.  I'm currently using the output path as "C:\folder\" & 
> Format(Date()-1,"mm-dd-yy") & " 1199563.xls".  While this will work for most 
> occasions, queries which are run on mondays need to contain the previous 
> friday's date.  To accomplish this, I'm using Date()-3.  There are occasions 
> where an operator will need to run a query for a date which is not in 
> sequence (run a query on 3-15-05, for date 3-01-05 etc).  Thus, my quest for 
> trying to figure out how to incorporate the date by which the query was run, 
> into the outputTo filename.
> 
> here is my macro process:
> 1. OpenForm
> Form name: 1199563
> View: form
> filter name: blank
> where: blank
> data mode: blank
> window mode: blank
> 
> 2. OutputTo
> Object Type: Form
> Object Name: 1199563
> Output Format: Microsoft Excel (*.xls)
> Output File: ="C:\" & [Forms]![1199563]![PROCESSDAT] & " 1199563.xls"
> Auto Start: No
> Template File: Blank.
> 
> Then the process repeats for the successive queries.  Any idea where I've 
> gone wrong?  Thanks for putting up with me :)
> 
> AZ Analog.
> 

Quantcast