thread705-1380756
Using PHV's PickFolder function (see thread above) I've created the following code:
When I use the highlighted line directing the output to the U: drive it works fine. The resultant files are placed in that directory and individually named as .pdf files.
When I use the line below which if I understand things correctly is supposed to take the strStartDir path that the user selects and concatenate that with the file name and send the pdf to that directory. Can anyone see what I'm doing wrong?
Using PHV's PickFolder function (see thread above) I've created the following code:
Code:
Private Sub cmd_PrintProg_Click()
'Perfoms Print report routines based on the option group selections
On Error GoTo Err_cmd_PrintReport_Click
Dim stDocName As String
Dim stDocName2 As String
Dim varItem As Variant
Dim strList As String
Dim stLinkCriteria As String
Dim intanswer
Dim FileName As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strStartDir As String
With Me.frame_ChooseReport
Select Case [frame_ChooseReport]
Case 1
stDocName = "rpt_WellHeader_Pinedale"
If Me.lbo_PrintSelectWells.ItemsSelected.Count = 0 Then
MsgBox ("No Items Selected for Printing")
Else
Call PickFolder(strStartDir)
Debug.Print strStartDir
For Each varItem In Me.lbo_PrintSelectWells.ItemsSelected
FileName = Me.lbo_PrintSelectWells.Column(1, varItem) & " " & Me.lbo_PrintSelectWells.Column(2, varItem)
strList = ",'" & Me.lbo_PrintSelectWells.Column(0, varItem) & "'"
strList = Mid$(strList, 2)
stLinkCriteria = "[API] IN (" & strList & ")"
Debug.Print stLinkCriteria; FileName
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
[highlight]
'DoCmd.OutputTo acReport, stDocName, acFormatPDF, "U:\Pinedale Exchange\PROGS\swt_ProgDump\" & "_" & FileName & ".pdf", False, ""
[/highlight]
DoCmd.OutputTo acReport, stDocName, acFormatPDF, strStartDir & " \ " & FileName, False, ""
DoCmd.Close acReport, stDocName, acSavePrompt
Next varItem
End If
When I use the highlighted line directing the output to the U: drive it works fine. The resultant files are placed in that directory and individually named as .pdf files.
When I use the line below which if I understand things correctly is supposed to take the strStartDir path that the user selects and concatenate that with the file name and send the pdf to that directory. Can anyone see what I'm doing wrong?