Microsoft, Access, 2007, VBA programming - system TEMP variable
Posted on 2008-11-05
I'm looking for a way to program my Access 2007 module to use the TEMP or TMP system variable for a location to save an Access generated report. I currently have it hard coded to use c:\temp but have found some users do not have a c:\temp or will not have access to c:\temp if they use a machine where they do not have local administrative priveleges. The TEMP and TMP variables should always be their own temp folder under Documents and Settings? Can I do this in Access? Is so, what is the syntax for the variable?
Here's my code...
strFileName = "c:\temp\ToolingRequest.rtf"
tempNo = 1000 + DCount("RecordNum", "ToolingTable", "Revision=1")
strDocName = "ToolingReport"
strWhere = "RecordNum = " & tempNo
DoCmd.OpenReport strDocName, acViewPreview, "", strWhere, , "entry"
DoCmd.OutputTo acOutputReport, strDocName, acFormatRTF, strFileName, False