I have a database user that is getting a "Run Time Error 2302: Access can't save the output data to the file that you've selected" when he runs the code to export data from the database to excel. This database is a split database with the linked tables stored on a server. He's using a laptop and only receives the error when he's working remotely but not when he's in the office. He does not remote into an office workstation from the laptop. I'm not quite sure why this error would be occurring and I'm looking to see if anyone has any ideas.
The code in question:
Code: Select all
Private Sub cmdRunReport_Click()
Dim Username As String
Dim strFolder As String
Dim strFile As String
Dim strWhere As String
Dim objXL As Object
Dim objWB As Object
If Me.ogrpReportOpts.Value = 2 Then
User = Environ("Username")
strFolder = "C:\Users\" & User & "\Documents\Daily Review\"
End If
If DCount("[VND]", "qryAllActiveCombinedFilters") = 0 Then
MsgBox "There are no records to display in this report!", vbExclamation
Exit Sub
End If
strFile = "rptAllActiveCombined.xls"
DoCmd.OutputTo ObjectType:=acOutputQuery, _
ObjectName:="qryAllActiveCombinedFilters", _
OutputFormat:=acFormatXLS, _
OutputFile:=strFolder & strFile
Application.FollowHyperlink strFolder & strFile
End Sub