I'm currently working in access creating a database that will send all of the people I've designated an email every month with files relevant to them and am trying to reference a textbox entry where the user will enter a date from an Access form in an access module. More specifically, I'm attempting to grab the text from the textbox and put it into the file path that I'm attempting to save each file to.
Instead of babbling on, here is a sample of what's not working in my code:
Dim timestamp as String
Dim territory as String
DoCmd.OpenForm "Sales Email"
Forms![Sales Email]![FromDate].SetFocus
territory = rs.fields(1)
timestamp = Forms![Sales Email]![FromDate].Text
DoCmd.OutputTo acOutputQuery, "TheNewQueryDef", acFormatXLS, "\\cletus\data\accounting\KRISTEN\Monthly Sales for " & territory & " " & timestamp & ".xls", False
Specifically it's telling me: "Run-time error '2302': Microsoft Office Access can't save the output data to the file you've selected."
Side note: Before I began working on adding in the timestamp variable (which I'm trying to get to reference the date entered in the form's textbox) to the file path, it worked perfectly how I needed it to.
Any input would be greatly appreciated! And sorry if I'm not clear - I'm still somewhat of a beginner when it comes to code. If more clarification is needed, please say so.
DoCmd.OutputTo. Do you know how to do that?