Import Multiple Excell Files
Jan 16, 2008
Super new to the forums and hoping I can find an answer here.
After looking for an hour or so on Microsoft's site, I gave up and decided to venture into new resources.
My ultimate goal is to create a form that will prompt a user to select a Microsoft Excel file and then run a macro. The macro should import the Excel file into a single table based off of what form is being run. The idea is to have a single form for each employee of a specific department and have the form import information that is stored on our phone server into access. I've set up most of the macro but the argument section of the filename is what's hanging me up.
So finally my question;
Is there a way to have a macro run to specify what file you want to import when using an additional macro? Am I going about this the completely wrong way and should stick to VB Code?
I look forward to your responses, thank you in advanced!
View Replies
ADVERTISEMENT
Sep 20, 2014
I made a database that in one of the forms, I like by clicking on a button the user be able to select 5 excel files with different file names (in the same directory) and then based on the imported file's names, it be stored in 5 different tables.
At the moment by using the bellow code, I can import multiple files (with the same formats) only into one table . My vba code comes as follow:
Function GetAllFiles()
Dim fd As Object
Dim strFilter As String
Dim lngItems As Long
Const msoFileDialogOpen As Long = 3
Const msoFileDialogViewDetails As Long = 2
[Code] ....
View 4 Replies
View Related
Aug 1, 2013
I am trying to build a newer database 2010, based on an older one,2000, that has been locked tight and I cannot see the modules to kinda get a reference of where to start. I am trying to find a VBA code that will allow me to import a several text files to one table. The text files are all in the same format but I cannot remove the page headers and footers to get the table to look right. I have attached an example of the text file i am trying to import but it is a stripped down version for information protection.
Also, it appears in the old Database Table once imported as:
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
If I could import the text files and end up with a table like this, it would be all i need as i could run all the queries i need from this.
View 3 Replies
View Related
Sep 20, 2006
Hi all, I'm trying to get the following done:
I have code which import Excel files into my database with the "DoCmd.TransferSpreadsheet". which works great.
But I'm now splitting the database and I want to have the Excel files which a user selects in his frontend database, imported in my backend database. I don't see the possibility in the TransferSpreadsheet as this is set to the CurrentDb.
My temporary solution is to import in the frontend and CopyObject to the Backend, but does anyone have a direct solution?
Thanks, Rob
View 1 Replies
View Related
Mar 3, 2006
Hi I have a few .csv files that i would like to upload into an access db. I saw an example for DTS, but since i dont have sql server i can't go that route.
Since i have some .csv Files where the file name changes on a daily basis, is it possible to upload them all with some wild card function. there is already a table with the fields already predetermined, and all i basically have to do is just load them all up at once.
please let me know if you have a solution.
View 2 Replies
View Related
Sep 7, 2013
I've been asked importing about 50 - 60 .DBF files into an Access database daily - and processing the data in Access to specs I don't have yet.
I'm pretty comfortable doing whatever once I have the data in the Access Database.
View 8 Replies
View Related
Jun 22, 2007
I have 100 or so 2-sheet excel workbooks. I need to import them all into an access table for analysis. They are all exactly the same format/layout etc but obviously have different data in them (they are customer satisfaction surveys). I only want to export 1 out of the 2 sheets on each workbook (the other is a front end, the data sits behind in sheet 2).
So, at the moment I have to go to 'get external data' > 'import' > select excel and then double click each file individually and then go through the import wizard. Now, I can get them all into one table but it's clearly time consuming.
Is there anyway of doing a batch import of multiple excel files to cut out the manual work described above? Or can anyone suggest a lateral get around?
Any help much appreciated. I should say that I am running excel 2003 and access XP (2002)
Matt
View 5 Replies
View Related
Jul 17, 2014
I have been trying to write a macro that will do the following:
- Look to a specific folder in my home drive (nb this may change)
- select all of the excel files that are in that folder
- select various cells in each of those spreadsheets - each spreadsheet is formatted the same with the same structure. The cells are random, e.g. D6, I22, H4, K4, D17, so I cannot select a whole range
- copy these cells and paste them into one row of a database
View 3 Replies
View Related
Dec 18, 2004
Hello everyone!
Here is my problem:
I have an Access database that contains a table with three columns (A & B & C). Field A is for code values and field B is for the value for that particular code. Field C holds the case number. I have a folder that contains the information for over 5000 case numbers. Each case number needs to be placed inside of the table. Considering there are 5000 case numbers, I dont want to use the import wizard 5000 times.
Furthermore, the text file only has two columns (for A and B).
I am trying to create a VBA that will append rows to the table by going into each file and placing the information into the table. The first row for each file contains the case number. So when the VBA runs, it should open the text file get the case number from the first row (field B on the text file) and place that in the case number field of the table for the entire file; and then repeat this action for all of the files in the entire folder.
Any help that can be provided will be greatly appreciated.
Thanks.
View 13 Replies
View Related
Apr 24, 2014
I have a requirement to create a piece of vba that will open all xlsx files in a folder one at a time then import the data in a range (sheet1!A1:G14) into a table named Weekly Input.
View 4 Replies
View Related
Mar 25, 2014
I have a lot of Excel files and each of them has 3 sheets that I would like to import in Access 2010. How can I import them without having to do one by one?
I always get error on
Code : Application.FileSearch
View 1 Replies
View Related
Jan 23, 2008
Hello,
I have some data in excel which I am importing it into MS Access 2002. Each excel file (one worksheet per file) is imported into separate tables.
I want to combine all my imported tables into one table. Is that possible, if yes then how and if no then what can be done to get single table after impoting data from various excel files.
Cheers,
Mandeep
View 14 Replies
View Related
Nov 24, 2014
I have an excel spreadsheet, that has a long list of names and unique numbers (of medical lab results)
I have another folder which has many text files (the actual lab reports), each of which has a file name that corresponds to one unique number in the excel spreadsheet.
How can I import the content of the text files into a single memo field (e.g. "LabResultContent") in the original datasheet?
View 4 Replies
View Related
Jul 12, 2015
some code I've come up to in order to import multiple excel files each of them with a different number of worksheets into an access table. The procedure is called from an Access database. The problem I have with the code is that when it encounters a workbook with only one worksheets (e.g. Sheet 1) it gives the error that "Sheet 2$" is not a valid name. When geting to a workbook with 2 sheets it says that "Sheet 3$" is not a valid name and so on and so forth. Is there a way to "check" the number of sheets in the workbooks and when it has only one sheet to transfer it and go to the next file?
Below is the code:
Code:
Sub ImportExcelFiles()
Dim strFile As String 'Filename's
Dim strFileList() As String ' File Array
Dim intFile As Integer 'Number of files
Dim filename As String
Dim path As String
DoCmd.SetWarnings False
path = "D:Tranzactii"
[Code]...
View 3 Replies
View Related
Jul 17, 2015
I have the following piece of code for importing the .csv files from a selected folder and then renaming them into 'imported & filename' if succesful and 'failed & filename' if import failes for whatever reason (bad formating, etc.).
The problem is that the first time it encounters a 'bad' file after another, instead of going again to the Error handler, the command
Code:
DoCmd.TransferText acImportDelim, , "Activitate", filename, True
gives me the default MS Access error, namely 2391. I would like it to go the the Error_handler again ang follow the course of actions and rename the files into 'failed' and 'imported'.
Here's the code:
Sub ImportActivitate()
Dim strFile As String 'Filename's
Dim strFileList() As String ' File Array
Dim intFile As Integer 'Number of files
Dim filename As String, sFullName As String, sFilename As String
DoCmd.SetWarnings False
[code]....
Also, how can I make the routine stop cycling through the files after I renamed them all?
View 3 Replies
View Related
Sep 18, 2007
I get this message when I import dbf files.
"The Microsoft Jet database engine could not find the object suitability.dbf. Make sure the object exists and that you spell its name and the path name correctly."
Can someone help? Thanks.
View 2 Replies
View Related
Apr 9, 2008
Hello all
this is my first post. I've tried to get my info without any luck so i ask my question here.... hope it's ok.
I want to import some dbase files that comes from an accounting software and ask Access some queries. The queries part is perfect. My only problem is how can i ask (in a general menu of my Access application) access to go and get those dBase files?
I want the user to be able to have a button asking him : " Do you want to import new data?. And then it will update Access. I don't need to append the data just overwrite the old data. I'm not doing any manipulation of data on the files, just asking questions. (Hope i make sense...)
They are always on the same directory on the server.
Thank you for the help!
View 14 Replies
View Related
Feb 16, 2006
Dear experts,
I need to import a csv file into a Access table. Some of the fields contain newlines, these field should go into a memo field (they're > 256 chars) which are to be displayed in a report later.
Unfortunately, Access (and also Excel) treat newline chars (vbCrLf) as field separators, resulting in a lot of garbage... I'm interested in one of three tricks:
1) find a way to import the csv file with newlines
- or -
2) replace the newlines by unused chars before import, e.g. by '#!' and replace them after the import in the table
- or -
3) replace the newlines, and re-insert them back in by an expression in a query or a report
I have succeeded to import the file with the newlines replaced. I did not succeed to re-insert newlines (at least not with "Replace"), and I couldn't find a way reconstruct the newlines with an expression or in a report.
Has anyone an idea or better trick to do the job ?
Thankss....
View 1 Replies
View Related
Nov 22, 2004
Hello, i have installed Access 97 from an Office 97 CD on a new laptop and when trying to import a table and browse to my file location i cannot 'see' any excel files to import, it only allows me to see Acess files or ODBC sources. it worked fine on my previous pc using the same install method. any ideas? -thanks Scott
View 4 Replies
View Related
Aug 23, 2005
Every time I try to import a CSV file into my Access database it crashes. I've tried repairing it but the repaired database crashes as well. Any ideas on what could cause this?
Thanks.
View 8 Replies
View Related
Dec 29, 2004
Does anyone know how to import or link files from the Quickbooks Timer program? I've tried changing it to a *.xls file extension and that didn't work, tried linking vs. importing, etc.
Any suggestions?
View 2 Replies
View Related
Feb 8, 2006
Hello, i want to make a button on my form to input .csv files. What is the best way to do this? I simply want to click the button and be asked for the csv location, i want the csv to be imported and be formatted. Whats the best way to do this?
View 2 Replies
View Related
Mar 8, 2006
hi i am trying to import a fe files that have a certain portion of the file name tat is the same.
Since i don't know the syntax in VB this makes it much more harder. I understand the logic, but writing is a chore.
can someone please look at this code and tell me what i am missing?
Code:Private Sub upload_Click()Dim strfile As Stringwirds = "D:RLConverterupload"strfile = Dir("wirds & *.csv")ChDir (wirds) Do While Len(strfile) > 0 If Mid(strfile, 1, 5) = Z56203 Then DoCmd.TransferText acImportDelim, "import spec", "data1", strfile, True Kill strfile strfile = Dir End If Loop End Sub
View 1 Replies
View Related
Apr 1, 2015
I have a form on access which allows users to upload csv files.
The files can be in any layout, so the field names and the number fields will always be different each time.
This can cause issues on data types, as access assumes a certain data type for a field, but the data may not always reflect that.
For example telephone numbers, access assumes this is a numeric field, however sometimes there will be symbols in this field such as +44. Which then causes import errors.
Is there any way to import these files without getting these sort of errors?
Currently the import process uses a simple TransferText method
DoCmd.TransferText acImportDelim, , "Original Data", Me.filelist.RowSource, True
This imports the data into a new table called 'Original Data'.
I had the idea of saving the table structure of the csv being imported (Importing the data with errors, then deleting all the records to just leave the structure) However I can't find a code to change the data types of that table to TEXT format, when I can't tell what the field names will be.
This whole thing is an automated process, which why there are loads barriers btw.
View 14 Replies
View Related
Feb 26, 2015
I've been creating an automated way for users to import an existing DBF III file into an Access Table and then I'll be doing some other things after it's in. The user needs to be able to click a command button to open up a file picker, select the desired DBF and then click import and have it be imported into a new table.
Originally I had this all working because there was only one possible file name for the DBF file in each folder so instead of using a file picker I used a folder picker and supplied the file name in the VBA code as it was static.
However, I now need the user to be able to select a specific file and the name could be anything.
I've successfully edited the file picker to allow them to select a file however the importing is an issue. In order to do a TransferDatabase command I need the file path alone for DatabaseName and the file name alone for Source.
What would be the best way to split those two pieces of data up once the user has selected the file they need?
View 1 Replies
View Related
Apr 9, 2014
I need to daily import files that start with same name, but the remaining part will be Bill of lading ID (e.g. TEST_BOL 1234.csv). The next day will be TEST_BOL 1235.csv) and so on. I need for Access to import the file based on the "TEST_BOL" into my database and then delete the file from the folder. I don't know how to initialize Access to look for the prefix and import in.
View 9 Replies
View Related