A family of Microsoft relational database management systems designed for ease of use.
Just to clarify the line should read:
.InitialFileName = "\sf1\user1\shared\Insurance Tracking Outsourcing\02-SWBC\Production\SWBC Active Loans Files"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want to have the file dialog box open to a specific folder location, but each time I run the code the file dialog opens to "My Documents". Here's the code:
Private Sub cmdGetRprt_Click()
On Error GoTo Err_cmdGetRprt_Click
Dim filesel As Variant, filepath As Variant
Dim filedesc as string
Dim dtUpldDt As Date
Dim dlgOpen As FileDialog
Dim fd As FileDialog
dtUpldDt = DLookup("DateCreate", "MSysObjects", "Name = 'SWBC_ActiveLoans2'")
If dtUpldDt < DateAdd("d", -7, Date) Then
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'msoFileDialogFolderPicker as an option
With fd
filepath = .InitialFileName = "\\sf1\user1\shared\Insurance Tracking Outsourcing\02-SWBC\Production\SWBC Active Loans Files"
'Have used %20 and it does not work as either: "\\sf1\user1\shared\Insurance%20Tracking%20Outsourcing\02-SWBC\Production\SWBC%20Active%20Loans%20Files"
.AllowMultiSelect = False
.Show
End With
For Each filesel In fd.SelectedItems
filedesc = filesel
Next filesel
If IsEmpty(filedesc) Then
MsgBox "No File Selected.", vbCritical
Exit Sub
Else
DoCmd.DeleteObject acTable, "SWBC_ActiveLoans"
DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel9, "SWBC_ActiveLoans", filedesc, True
End If
DoCmd.SetWarnings False
DoCmd.OpenQuery "qmkActiveLoans"
DoCmd.SetWarnings True
End If
DoCmd.OpenQuery "qSWBCInsuranceData"
Exit_cmdGetRprt_Click:
Exit Sub
Err_cmdGetRprt_Click:
MsgBox Err.Description
Resume Exit_cmdGetRprt_Click
End Sub
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Just to clarify the line should read:
.InitialFileName = "\sf1\user1\shared\Insurance Tracking Outsourcing\02-SWBC\Production\SWBC Active Loans Files"
Answer accepted by question author
Get rid of the filepath = in your code