Modules & VBA :: Automating Daily Import Of CSV File

Aug 10, 2013

We receive a daily csv file from another database and we are trying to automate this process as much as possible.

At the moment, the other system will extract any new records, save a file as importddmmyyyy.csv in a specified location e.g. c:importpendingimportddmmyyyy.csv and then make a call to open access giving access the file path as follows

masaccess.exe "C:mydatabase.mdb" /nostartup / Excl/ cmd Filepath="c:importpendingimport09082013.csv"

I have configured access to automatically open a form, "ImportForm" when it opens, and I have configured this form to automatically run an event procedure on loading "importdailyfile".

My problem lies in writing this procedure. Basically I need it to run the Transfer Text command (I have already create an import specification)

DoCmd.TransferText acImportDelim, "myimportspec", "table to append the data to", filepath, true

The problem I am facing is that as the filepath changes on a daily basis given the naming conventions (which i cannot change) and my knowledge of VBA s pretty basic, I don't know how to make the procedure pick up the filepath that the other system is providing in the call to open access.

View Replies


ADVERTISEMENT

Modules & VBA :: Daily File Import Timestamp Shift

Mar 17, 2014

I have a daily file to import. If I hard code the entire file name my code works. My problem is getting around the daily name change of the file.The owner has an automated process that creates the file so the name every day is slightly different due to the timestamp. Here's an example

Today's file is "mydailyfile_20140317_1035.xls"
Tomorrow will be "mydailyfile_20140318_1033.xls"

I can account for date using "sFileDate = Format(Now(), "yyyymmdd")".The hour/minutes is never the same.is there a wildcard solution??

View 5 Replies View Related

Automating A Import Function

Jan 23, 2007

I am trying to automate an import function for my database. I recieve a disk that has about 200 little spreadsheets on it every month. I need to either import these or set-up link tables to them in a more automated system than doing it all manually. (It takes a lot of time to do manually) Please can anyone help.
Note: The files are all named 3000 to 3200. The following month they are called the same. I'm hoping this will not cause to much of a problem.
PLEASE HELP

View 5 Replies View Related

Automating Import And Export

Feb 11, 2013

I would like to automate this daily process: In this order import or link, (not sure which is the best option) a fixed width table, add an ascending number to the end of each of the records, reverse the order, and finally export to fixed width .txt documents depending on the quantities in one field. There would be 3 text files exported, max.

View 4 Replies View Related

Automating Import Of Excel Into Access

Sep 7, 2005

Hello All
is there a way (i guess using VBA) to import an excel spreadsheet into an access table without having to go through the wizards, if you know all the field names and other variables ??

Yours in anticipation

DJS

View 8 Replies View Related

Tables :: Daily Import From Excel - Current Only

Jun 11, 2014

I'm working with an A/P department that is using "legacy technology" and has no capability for maintaining notes on invoices due, etc. I'd like to give them a database that would provide them with the features they need, but I'm running into a conceptual snag.

I am able to extract from their database system all open invoices each day. For each invoice, the A/P person will make notes from day to day on approvals to pay, any problems with the invoice or related inventory or service, discussions with the vendor, etc. So, let's say on Monday they make notes on a particular open invoice. On Tuesday, they'll pull all open invoices from their system and import that set of invoices into the Access database. Some will be new, but many will already be in the table. Using the Vendor Number and Invoice Number together as the table key, I can avoid duplication into the table. But, some already in the database will not appear in the new extract because they've been paid.

So, my question is... how do I get to a point where they can do this import each day and see only the invoices that are currently open AND maintain their previously-entered notes? I thought first that there would be a query to run each day, but I don't know how to keep consistency regarding table names in the query, etc, so the query doesn't have to be edited for each new import. Would this be an append to get the new ones? If so, how do I drop the ones that are not in the newest extracted data?

A complication, of course, is that I want them to be autonomous and able to do this without my input each day.

View 6 Replies View Related

Automate Import Of Daily Report From Another Source

Oct 30, 2014

The multi-user application I'm making uses data from another system. I get reports in csv format e-mailed to me in zip format. Since it's a multi-user system, I have to create a table with the records from the csv I get an error message that someone is viewing the data if I try viewing it while someone is viewing it.

When I get the e-mail with the latest version of the csv, I unzip it and replace the older file in the folder location that the Access database is linked to. I have a sub routine that deletes everything from the table and inserts the records from the latest csv. I execute the sub by pressing a button.

Is there a way to automate unzipping the file, extracting it to the folder and running the sql code in VBA?

View 2 Replies View Related

General :: Scheduled Task To Import Daily CSV Exports?

May 18, 2015

We have small data dumps from a webservice delivered to us daily in csv format. I'd like to create a system where we can have the data automatically imported into either Access.

My idea is this:

1. CSV is downloaded to <x> folder.

2. Scheduled Task runs script to look in folder <x>

3. If CSV is found in folder <x>, import it's data into a fixed Access db->table.

4. Move CSV to an archive folder to avoid re-processing.

Is this feasible? How complicated would it be, and how to get it on track?

View 1 Replies View Related

Modules & VBA :: Import File With Dynamic Name

Jan 28, 2014

I have text files placed into a folder like AIN28_01012014_1355.txt

I need to import these but the files have the date and time added to the name which i cannot stop AIN28_ will always be the same is there a way to import the file just off AIN_*.txt or something like that

I was thinking i could use file copy and change the name but that needs to know the exact names doesn't it...

View 1 Replies View Related

Modules & VBA :: Download File From Url And Import To Table

Sep 2, 2013

i am trying to download an excel document from a url and the import it into a table i can successfully download the file to my desktop but when i try to import it i get the below error the Microsoft office access database engine cannot open or write to file 'C:documents and settingsJHalliweDesktop' it is already opened exclusively by another user, or you need permission to view and write its data..i have checked and the excel book is not open ( i think its trying to open while its still downloading is there away around this

Code:
Dim strUserName As String
strUserName = Environ("UserName")
Dim FolderLoc As String
FolderLoc = "C:Documents and Settings" & strUserName & "Desktop"
Dim StFile As String
Dim MySelect
MySelect = Forms!FrmIndex!Text134

[code]....

View 3 Replies View Related

Modules & VBA :: Import Button To Ask For Location Of File

Oct 22, 2013

I have been searching all over on how to create an import button on a form in access 2010 where I can set which table it should copy the data into but the user could locate the import file.

NOTE: the reason being I have locked all the ribbons...

If necessary I could make a specific import template file which would have all the headings locked...

View 4 Replies View Related

Modules & VBA :: Function To Import Most Recent File

Sep 29, 2014

There is a manual process I'd like to automate. Instead of the user manually importing an external file into a table, I want a function to grab the most recent file in a particular directory. Is that possible?For example, I have a table called Input, and I want to append the file I just saved on my network, which in this case is G:Files2014TA_140928_011007.txt. The two ways to know which file to use is that the date is part of the filename (TA_ YYMMDD_ 999999. txt), and also the Date Modified attribute.

I am aware that if the user needs to work the files out of date order, he/she cannot use this code.

View 1 Replies View Related

Modules & VBA :: Import Complex Text File Into Access

Jul 19, 2014

They are receiving e-mail with some data that they want to transfer to access database to track. The one think they can do is copy past, copy paste. That is a lot of data to copy and paste. The date looks like this format

Field1
Text1

Field2
Text2 (text2 can be more than 255 char)

Field3
Text3 (text3 can be more than 255 char)

Field4
Text4

Field1
Text1

Field2
Text2 (text2 can be more than 255 char)

Field3
Text3 (text3 can be more than 255 char)

Field4
Text4

and so on.. It can be 50 records

I am thinking they can copy this to the text file. Then the code form Access grabs the text file and imports to access table with format below.

Field1 Fied2 Field3 Field4
Text1 Text2 Text3 Text4

View 14 Replies View Related

Modules & VBA :: How To Import Multiple-table Html File

Jan 16, 2014

I need to import a html file automatically BUT my file has many tables in it, when I am doing the importation it asks about which table I want to import, the thing is that I always want every tables. The number of tables is variable. VBA code so it can have a looping which says to import every table in my HTML file?

View 1 Replies View Related

Modules & VBA :: Import Pipe Delimited Text File Into Table?

Apr 2, 2015

I'm trying to import a pipe delimited text file into a table. I can import the entire table using the following code, but I only get one column of data (the entire data set in one column). If possible I would like to import with the columns defined or if not possible use some code for a function similar to text to columns.

Code:

DoCmd.TransferText acImportDelim, , "tblTest", "C:Work2015PPVMasterData.txt"

View 4 Replies View Related

Modules & VBA :: Allow A User To Navigate To A Text File And Import It To A Database

Aug 19, 2013

We have a function that will allow a user to navigate to a text file and import it to a database. I've been asked to make it import ALL the text files from all sub-directories in the directory IF they've never been imported before (based on FileName and LastModifiedDate). I've set up a table to track what's getting imported (tbl_ImportHistory). I'm thinking what I need to do is use the previous coder's GetFileName function in a recursive loop removing the navigation request and adding the comparison and then, if it imports the file, the name and date need to be added to the tbl_ImportHistory table. But I'm completely unsure of how to do it.

I'm posting the GetFileName function below. I believe once I've got it modified the rest of the code can be left intact as it just parse's and loads whatever file is selected in the GetFileName function.

<code>
Function GetFileName() As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = False
Dim vrtSelectedItem As Variant

[code]....

View 5 Replies View Related

Modules & VBA :: Attempting To Import Tab Delimited Text File With 274 Columns Into 2 Access Tables

Aug 2, 2013

I'm trying to import a text file with 273 fields into two tables. I've been able to do this with the code I found on an old thread and I'm now trying to accomplish everything with one step. The file I'm importing is tab delimited text file. With this current code I'm only able to populate the first record in the table and then I get error message. (Run-time error '3265') (Item cannot be found in the collection corresponding to the reqested name or ordinal).

Code:

Public Sub ImportTextFile()
' to use the ADODB.Recordset, be sure you have a reference set to ADO
Dim rst As ADODb.Recordset
Dim rst2 As ADODb.Recordset
Dim strFile As String
Dim strInput As String
Dim varSplit As Variant
Dim intCount As Integer

[code]...

View 4 Replies View Related

Modules & VBA :: Import Excel File Into Access And Append A Date To A Field From Unbound Text Box

Aug 22, 2014

I have a form which i use for a user to select an excel file they want to import and then click a cmd button to import the file into a table which works fine, however i want to append a date into a date field from an unbound txtbx before the file is imported so it will look something like;

id;date;excel info;excel info;excel info.

View 7 Replies View Related

Text File To MS Excel Multiple File Import Application

Jul 20, 2006

hello,

I would like to automate something presently done on a one-by-one basis. Here: a number of text files(containing data) are to be exported into an MS Excel file, with each text file to occupy a different worksheet. Presently, the idea is to use the Data/import external data/import data feature of MS Excel for importing the text files one-by-one into newly created worksheets(within the same workbook).

I would appreciate some advice on how to go about creating a useful MS Access application to achieve the above. I have checked the available Macros in MS Access, but I could not find one to suit my purpose. can anyone pls assist, on how I can get started?

Tokunbo

View 3 Replies View Related

Modules & VBA :: Automating Mailmerge From Access Form To Word Document

Aug 5, 2013

I am having the strangest results with my automated mailmerge. Basically it does work, but not all the time. The basic idea is to allow the user to dynamically create a query that produces a result list which fills a temporary table. The use then selects a prebuilt merge template and merge is executed against the temp table. The merge template are of the .doc type, but sme have been converted to .docx; the .doc files tend to work most often, but all of the will eventually get a Table is locked message... However if I run in test mode with code breaks and manually step through the process it always works... here is the heart of the code ...

Err_Pos = 10

Code:
DoCmd.SetWarnings False
' if tmp tbl left over from last run kill it
DoCmd.RunSQL "Drop table Word_Merge_Tmp_TBL"
Err_Pos = 12

[Code].....

There are many error cases in the error catch routine. That I have managed to make Access stop hanging when word has a problem or the table is locked. But I can't get the table to be free consistantly and why does it always work when I manually step through the code.

View 4 Replies View Related

Modules & VBA :: Automating Data Entry For Weekly / Biweekly Dates

Oct 24, 2013

I am trying to write code for a form. When the user enters the "Number of Payments" and the "1st payment date" it will fill the amount of the payment into a specific month.

For example: 1st payment date would be 10/24 the payments would be bi-weekly and the amount would be $50.00. The number of payments would be 4. I would need it to put $50.00 into a field called "October" $100.00 into a field called "November" and $50.00 into a field called "December". In excel I would do this simply by using a (date)+14 formula. I am sure that I need to do this with loops but where to even begin.

View 1 Replies View Related

Modules & VBA :: How To Import Text File Line By Line

Nov 18, 2014

I am having a little difficulty with my importing in Access. Every time I import my text file, the lines will be jumbled. I have been reading up and I found this recordset code that seems to be what I need:

Code:
Dim strLine As String
Dim intLineNum As Integer
Dim MyDB As DAO.Database
Dim rst As DAO.Recordset
Open "C:TestTest.txt" For Input As #1
Set MyDB = CurrentDb
Set rst = MyDB.OpenRecordset("tblResults", dbOpenDynaset)
CurrentDb.Execute "DELETE * FROM tblResults", dbFailOnError 'Clear tblResults

[code]....

Basically, this code will extract data from the text file as long as it fulfills the Mid$ criteria. Here's where my problem comes. Each line in my text file is of different lengths and I have to capture the entire line.

I think using the Left$ function would work, but I don't know how to determine the character count such that the entire line of text would be inserted into the table.

Another difference between what I need and the code above is that, I am required to store each line into each row of my table, meaning

Line 1 is placed in Row 1 Column 1
Line 2 is placed in Row 2 Column 1
Line 3 is placed in Row 3 Column 1
.
.
.
Line X is placed in Row X Column 1.

View 14 Replies View Related

Import A Text File Weekly Within A Batch File

Jan 30, 2006

hello everyone, i really need some detailed help as the deadline is approaching and I need to find a solution for this. Any help would be greatly appreciated

I currently have a batch file that ftps a text file from a Red Hat Linux Server to my W2k C:. I would like to make another command in the batch file that imports this text file into an existing access table. I would like the text file to repopulate the table everytime it is imported. I do not want the data added on to the existing data in the table.

Thank you for your time and insight.!!!:)

View 3 Replies View Related

Modules & VBA :: How To Make Daily Stock Inventory

Jan 5, 2014

I have an inventory app, how to make daily opening stock /closing stock.I want the system done automatically,that is as users exit,closing stocks & next day opening stocks as users log in.Then daily stock reports can be generated.

View 2 Replies View Related

Modules & VBA :: Import Csv Files And Rename Them After Import Into (imported) And (failed)

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

Modules & VBA :: Backup Records Programmatically Daily To Another Table

Jan 8, 2014

i have 2tables,table1=productid,ProductName,Qty table2=Productid,productName,Qty,date(). I want to be able to backup Records programatically daily from table1 into table2 OnClose.But i do not want duplication of record in the same day. If changes occurs in table1 after backup,table2 should be updated Programatically.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved