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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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