Exporting to File based on path in Text Box

MCTampa

Board Regular
Joined
Apr 14, 2016
Messages
97
I am trying to use the DoCmd.OutputTo function to output to a file based on the values in a text box.

Here is what I'm using:
Code:
 Do.Cmd.OutputTo acOutputQuery, "Monthly Detailed Report", Excel97-Excel2003Workbook(*.xls)", "Screen.ActiveForm!Text1216 & " \ "& Monthly Detailed Report......

The path to the file is in text box 1216 and it reads: G:\IRM\001 Javier Diaz
However I'm getting the error "Type Mismatch" and I cannot understand why.
Any help would be appreciated.

Mike
 
Last edited:
The text boxes are the active form at the time the function is being run. I use Screen.ActiveForm...for many of the functions on my form.
The function is located in the only module in the database....I have a few different functions in that module.

The path I am tying to save to (in Text1216) is: G:\IRM\001 JavierDiaz\Purchase Space\2019\03 Mar\

Could it be that my path does not have a " in front of it?
 
Last edited:
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Got it to work.

I mostly used your code:

Code:
Function Archive_Detailed()
'On Error GoTo Email_Report_Err
Dim fName As String
fName = Screen.ActiveForm!Text1216 & "Monthly Detailed Report as of " & MonthName(Screen.ActiveForm!Text1122, False) & " " & (Screen.ActiveForm!Text1141) & ".xls"
MsgBox fName
DoCmd.OutputTo acOutputQuery, "Monthly Detailed Report", "Excel97-Excel2003Workbook(*.xls)", fName, False, "", , acExportQualityPrint
Proc____Email_Report_Exit:
    Exit Function
Proc____Email_Report_Err:
    MsgBox Error$
    Resume Proc____Email_Report_Exit
End Function
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,204
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top