Hi,
I'm trying to add the location that user picks as a string so I can use the same path to export reports to but having trouble doing so. Please look at the VBA below. I'm just trying to save the user selected location to 'sFolder' and then use rloc to have the same value. Please see line 18.
I'm trying to add the location that user picks as a string so I can use the same path to export reports to but having trouble doing so. Please look at the VBA below. I'm just trying to save the user selected location to 'sFolder' and then use rloc to have the same value. Please see line 18.
VBA Code:
Option Compare Database
Private Sub Command0_Click()
Dim rs As DAO.Recordset
Dim rsSQL As String
Dim hsql As String
Dim bsql As String
Dim gid As String
Dim gbor As String
Dim rloc As String
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim fsql As String
DoCmd.SetWarnings False
DoCmd.OpenQuery "qRawMT"
fsql = "ALTER TABLE tRaw ADD COLUMN ****ingID COUNTER;"
DoCmd.RunSQL fsql
rsSQL = "SELECT DISTINCT tRaw.GroupID, tRaw.Borrower FROM tRaw;"
rloc = sFolder
Set rs = CurrentDb.OpenRecordset(rsSQL)
rs.MoveFirst
DoCmd.OutputTo acOutputReport, "rGroupBilling", acFormatPDF, rloc & gbor & " " & gdt & ".pdf"
Pause (5)
rs.MoveNext
Loop
Me.lblIntro.Visible = False
Me.lblReady.Visible = True
Me.lblReady2.Visible = False
'DoCmd.DeleteObject acTable, "tRaw"
DoCmd.SetWarnings True
End Sub
Private Sub Command12_Click()
'Declare a variable as a FileDialog object.
Dim sFolder As String
'Create a FileDialog object as a File Picker dialog box.
With Application.FileDialog(msoFileDialogFolderPicker)
'Declare a variable to contain the path of each selected item.
'Use the Show method to display the File Picker dialog box and return the user's action.
'The user pressed the action button.
If .Show = -1 Then
sFolder = .SelectedItems(1)
End If
End With
End Sub