Unanswered: command button to open "Import file" dialogue box
I have a database that requires multiple tables to be imported weekly from a single XML file (the XML file name is new each week).
I would like to have a button on a form that opens the Import File dialogue box so that a user can just go find that week's file and import it.
I have tried and tried but I cannot figure this out...can anyone help? Thank you! PS - I'm using Access 2003.
Yes, I've been trying to make that work but I'm still having problems with the import part of it. I can get the Open file dialogue box to open, and I can select my XML file, but I don't know how to import it from there.
Part of my problem is that I don't know any programming, so I can cut and paste code but I actually understand very little of it. Is there any way someone could walk me through it?
Thanks so much.
Dim strPath As String
strPath = OpenCommDlg("Import Files", "", -1, "\\InitialPathHere")
If Len(strPath) > 0 And Right(strPath, 3) = "xls" Then
CurrentDb.Execute "DELETE * FROM Excel401k"
'import data from selected file
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Excel401k", strPath, True