I have two computers, desktop and a laptop. Both computers have their own version of Access. The database is stored on the C: of the desktop and is used from either the desktop or the laptop.
I have a button that converts a report to a pdf and then puts the pdf in a specific file folder using the date & time as the file name.
The button works find from the desktop, but does not work from the laptop. From the laptop the button will open up the report but that is where the process stops.
Not sure what is missing here, but I would guess that I need something in the file path to distinguish the two computers, or more precisely I need to label so that the pdf document ends up in the desktop and not the laptop as both computers have a c:
Public Sub tabExportPDF_Click()
Dim ToDate As Date
Dim CurrentTime As String
Dim NetWorkPath As String
Dim ExportPath As String
ToDate = Date
CurrentTime = Format(CStr(Now), "hh-mm_ampm")
NetWorkPath = "c:\Users\DHPA\Documents\Digby Harbour Port Association\DHPA Database\Maps\"
ExportPath = NetWorkPath & "\" & "Map_" & ToDate & "_" & CurrentTime & ".pdf"
On Error GoTo ErrHandler
DoCmd.OpenReport "rptMap", acViewPreview
DoCmd.OutputTo acOutputReport, "rptMap", acFormatPDF, ExportPath
DoCmd.Close acReport, "rptMap"
MsgBox prompt:="PDF File exported to: " & vbNewLine & NetWorkPath, buttons:=vbInformation, Title:="Map Exported as PDF"
ErrHandler:
If Err <> 2501 Then
End If
End Sub