My database will save excel files on a network location (to save space in the database). I've created a maintenance table that will allow the administrator to change the network location where the excel files will be saved. But am getting a syntax error. The code is supposed to save the file path and name in a maintenance table. See below.
Code:
Private Sub cmdQALocation_Click()
' This code will open a file dialog box and allow administrator to select the location for the QA Master File
' The QA Master file must be in excel format
Dim fd As FileDialog
Dim objfl As Variant
Dim strQAFileLocation As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.ButtonName = "Select"
.AllowMultiSelect = False
.Filters.Add "xlsx", "*.xlsx"
.Filters.Add "xlsm", "*.xlsm"
.Filters.Add "xls", "*.xls"
.Title = "Choose Quality Alert Master File"
.InitialView = msoFileDialogViewDetails
.Show
For Each objfl In .SelectedItems
strQAFileLocation = objfl
Next objfl
On Error GoTo 0
End With
Set fd = Nothing
DoCmd.RunSQL "UPDATE tblMaintenance SET QA_Location = " & strQAFileLocation & " WHERE ID = 1"
End Sub
Any Help would be appreciated!