Thanks for your response. I tried using the code from the website you
gave me. As I said, I've got the save dialog box to work with OutputTo
but not with the TransferText. The open file dialog box works fine
too. I'm not really sure how to do this. Any useful advice is
appreciated. THANK YOU.
On Jun 20, 5:10 pm, "Douglas J. Steele"
I don't see anywhere in your code where you're calling GetOpenFile to
set a
value for strFileName.
--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)
I did my best to follow your advice. However, I've used that site
before and got everything working. When I was using:
DoCmd.OutputTo acQuery, "Query1", acFormatTXT
to export the query to a document, the SAVE AS file dialog box came
up
and worked, no problem. So it has nothign to do with the code on the
module. That was the only code I used to export. I did not even have
to refer to the new module.
However, the above code does not give me the output I was hoping for.
This code does:
DoCmd.TransferText acExportDelim,,"Query1",strFileName,True
However, it doesn't bring up the save as box. The OPEN dialog box
comes up without a problem, as I use it in a previous step.
Here is all of my code....any ideas?
_________start________________
Private Sub Command0_Click()
On Error GoTo err_Command0_Click
Dim strFile As String
Dim strSQL As String
Dim strSaveFileName As String
strFile = GetOpenFile_CLT("M:\LTSO\ADC Systems\SAB\Novell\Disk
Space", "Select the .csv file that you want to filter")
If strFile = "" Then
Exit Sub
Else
If MsgBox("Filter out the following file: " & strFile, vbYesNo, "Disk
Space Report Filter") = vbNo Then
Exit Sub
Else
End If
End If
DoCmd.TransferText acImportDelim, "DISKS2", "Disk Utilization
Information Entry", strFile, True
DoCmd.SetWarnings False
strSQL = "SELECT [Disk Information].[File Server Name (DN)], [Disk
Information ].[Volume Name], [Disk Information ].[Volume Size (Mb)],
[Disk Information ].[Space In Use (Mb)] " & _
"FROM [Disk Information ] " & _
"GROUP BY [Disk Information ].[File Server Name (DN)], [Disk
Information ].[Volume Name], [Disk Information ].[Volume Size (Mb)],
[Disk Information ].[Space In Use (Mb)] " & _
"HAVING [Disk Information ].[File Server Name (DN)] Not Like '*NCS*'
"
& _
"ORDER BY [Disk Information ].[Volume Name]"
CurrentDb.QueryDefs("Query1").SQL = strSQL
DoCmd.TransferText acExportDelim, , "Query1", strFileName, True
MsgBox "Filtering data has completed successfully", vbOKOnly, "Filter
Data"
DoCmd.Close acForm, "Form1"
exit_Command0_Click:
Exit Sub
err_Command0_Click:
If Err.Number = 3107 Then
MsgBox "You are not authorized to add data.", , "Unauthorized"
Exit Sub
Else
MsgBox Err.Number & " " & Err.Description
Resume exit_Command0_Click
End If
End Sub
__________end__________________- Hide quoted text -
- Show quoted text -