sambucaman
Registered User.
- Local time
- Today, 09:23
- Joined
- May 6, 2010
- Messages
- 41
Hi everyone.
I'm looking for a better way to auto import data to a table, via a click button on a form. I am currently using the below method...
The above has a few drawbacks, mainly that each user / pc has a different logon, so a different path. Each time I update or change the DB, I then have to go round the office and change the code on each PC. The other bad flaw is we cant see which file we are selecting, and I'm relying on people to manually name their xls file correctly.
Does anyone know of some VBA that will go in here to open a browse box, allowing user to browse to ANY .xls file and selecting that?
Have experimented with browsing for files before, never had any success.
Thanks in advance.
I'm looking for a better way to auto import data to a table, via a click button on a form. I am currently using the below method...
Code:
Private Sub import_Click()
MsgBox "You are about to import the photographers work into this database. Please ensure that the staff database is renamed 'customers.xls' and saved on your desktop.."
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Customers", "c:\users\photographer\desktop\Customers.xls", True
DoCmd.Close
DoCmd.OpenForm "Customers"
End Sub
The above has a few drawbacks, mainly that each user / pc has a different logon, so a different path. Each time I update or change the DB, I then have to go round the office and change the code on each PC. The other bad flaw is we cant see which file we are selecting, and I'm relying on people to manually name their xls file correctly.
Does anyone know of some VBA that will go in here to open a browse box, allowing user to browse to ANY .xls file and selecting that?
Have experimented with browsing for files before, never had any success.
Thanks in advance.
