I am by no means an expert and all I know is what I have taught myself. I am creating a db to micro manage elements of projects I work on.
I have an unbound form which I found and adapted online. On the form there are 2 buttons and a text field. One button runs vba code and opens a dialog box and inserts the file path of any DB I select located on my drive in the form's text box. All good
The other button deletes table data and appends records to the file at the path in the text box. Like an export to a user DB?
My problem is the deletes work fine but I cant seem to get the variable file name/syntax right in the DoCmd.RunSQL statement, see a sample below, where am I going wrong? I am also using the variable elsewhere to OpenDatabase(strFileName) for the deletes so its right there. This is a sample of what I have. I get the error "could not find file path" With everything up to my folder and the variable string name as written not the full path string I'm looking for C:\Folder\strFileName in the error message.
Dim strFileName As String
strFileName = Me.TextBoxPath.Value
DoCmd.RunSQL ("INSERT INTO [Projects] IN 'strFileName'" & _
"SELECT [Projects].*" & _
"FROM [Projects]" & _
"WHERE (((Projects.ProjectID)=[Forms]![Projects Dashboard]![Combo519]
Thanks in advance