DoCmd.TransferText only if file is new

Can Access determine if a text file's time stamp is less than 24 hours old before choosing to import the file with a DoCmd.TransferText command?

A delimited text file should be updated daily and I only want the file's contents imported if the file is new.

Sponsored Links:

Related Topics

DoCmd.TransferText VBA versus Wizard
I am having issues importing a space delimited file with DoCmd.TransferText. I created a specification name through File->Get External Data->Import. It all works fine when I import the file via the MS Access Import wizard and use the import specification name but when I replicate the same process through

1) DoCmd.TransferText acImportDelim, "202DailyListImportSpecification", "tmp_202", cleanfile, False
that does not cooperate at all. The first 11 fields from the text file are imported in the first field of the table.
In either case, I do the import in a newly created table.


import text with docmd.transfertext
I am trying to import a text file using the command docmd.transfertext
this is my code:

DoCmd.TransferText acImportDelim, "IMPORT", _
"AMEX", "volbyclass-amex.txt", -1

my text file is in the same directory as my access database but it doesn't work. it gives me an error that it cannot find the file.

If I put the whole path (ex: c:\.) it works perfectly but I obviously don't want to do that because it won't be portable. what am I missing


Importing a Text File Using Macros
I am trying to import a text file into Access but I want to let the user select where the file is located. In the "TransferText" macro the File Name is mandatory. Is there a way around this? Can the DoCmd.TransferText command get around this? If so, how do you do this


DoCmd.TransferText acExportFixed
I am trying to use the DoCmd.TransferText acExportFixed command to create a text file. but everytime I run the code I get the error Run-time error '2511':
The action or method requires a Specification Name argument.

I have created the Spec file by doing the export clicking on the advanced tab creating my field sizes and saving the spec file (ClaimsExportSpecs). If I run the export manually everything works fine.

I've also tried the Schema.ini file and put it in the same directory I'm putting my export file. The Schema.ini gives me a Run-time error '424': Object Required error.

My code is:
DoCmd.TransferText acExportFixed, ClaimsExportSpecs, "qryExport", "C:\Export Test\ExportTest.txt"

and/or (trying both ways)

DoCmd.TransferText acExportFixed, Schema.ini, "qryExport", "C:\Export Test\ExportTest.txt"

doing an acExportDelim works fine but I need it in fixed format


DoCmd.TransferText method problem
I am trying to import a text file to a table in Access 2010. When I execute the specification directly everything work fine. However, when I execute the specification using a DoCmd.TransferText method, everything transfers correctly, but I also get a new table that is called Name AutoCorrect Save Failure.


TransferText / Import
I've been using DoCmd.TransferText to import a prenamed text file, however, would like to giv the user the ability to specify the file to be imported, including the ability to select multiple files to import/ append to table at once.


DoCmd.TransferText acImportDelim Question
I an doing a TransferText that is working well.

The problem that arises sometimes is when the file I am grabbing has delimiter errors in it.

Access is still importing the file but it is not producing an error. I have error trapping in it but it is not coming up with anything. Instead Access is making a table that has a reference to the import error. Users do not see the tables of course and they may not notice an error in their data.

Anyone know of a way for me to detect this error so I can alert the user to check their import file


TransferText without an import spec
Having probs with this. Want to use this to import without an import spec.

I've tried;

DoCmd.TransferText acImportDelim, "", tbl7480Errors, str7480ErorrsPath, True

and also

DoCmd.TransferText acImportDelim,, tbl7480Errors, str7480ErorrsPath, True

And it just keeps saying "The action or method requires a table name argument", but the table name's there.

I do not want to create an import spec - MS's documentation is clear that this can be omitted where the file is delimited.

It's a CSV file, and the table has been created already


DoCmd.TransferText - import doesn't include new fields
I have code that uses the DoCmd.TransferText acImportDelim to import a pipe delimited text file to a created Access table. The text file is an export from another software program. I have added data elements to the export and the same data elements to my Access table. When I run the code to import the text file, it does not recognize the new data elements. Searching through the Forum, I could not find a similar problem


text import
I have a text file that is one record and uses a ~ as a delimiter between fields.
I used the DoCmd.transferText Statement
DoCmd.TransferText acImportFixed = 1, , "NewImport", "W:\NewImport.txt
It imported as one record creating field names field1.field255.
What I really want it import it as is one field with as many records as it needs.


Issue with DoCmd TransferText
I have a button on a form which has code to delete and table and then import that same table from a network folder. When I run the job I get an error telling me "The text file specification does not exist." But it does.

Here is my code:

DoCmd.TransferText acImportDelim, "ImportOLMData", "BacklogDataTable", "C:\Documents and Settings\bfawcett\Desktop\Business Analyst - Brian Fawcett\Development\Leasing\o3916021.csv"

Does anyone know what might be wrong?


Importing a CSV file? Erroring out
The line below codes the vba code that keeps erroring out with a "[31519]: You cannot import this file" message. According to the Access 2003 VBA Language Reference, TransferText Method, the syntax is used correct.

expression.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage.

1) expression.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage.
2)

1) DoCmd.TransferText acImportDelim, "Credit_Memo", "L:\UH_Warehouse_Reporting\SciQuestData\Credit_Memo.csv", True


Adding Header & Trailer Records to TransferText Exports
I'm using MS Access 2003.

I have code that exports the results of a query to CSV file using DoCmd.TransferText. However, since this export file will be used in an EDI transmission, I also need to prepend headerrecords and append trailer records to the extract.

Can/should this be done within Access? What's the best approach?


Docmd.TransferText Spec File Not Found
I am running this piece of code:

strSpec = "Import-ValueGrowth"
DoCmd.TransferText acImportDelim, strSpec, "tblValueGrowth", strFileName

and I am getting an error message saying "Run Time Error 3265 - The Text File Specification Import-ValueGrowth does not exist etc"

But the file spec does exist, it is spelt correctly etc.

Any ideas, anyone? This is a mystery.

A Few more things possibly related:
>>> Tried to delete and recreate specification, repair db, reinstall Office - no luck
>>> Tried to create a Macro - and there are no actions after those beginning with S. (e.g. No Transfer Text action showing for a Macro


Error on TransferText method
I am just trying to export the contents of a table to a csv file. Here is my command.

DoCmd.TransferText acExportDelim, "ballotdist", "BallotDistribution", ballotdist.csv, True

The "ballotdist" is my specification file and "BallotDistribution" is my table name. I want all the data for this table to a csv file. I am getting an error message on the execution of this statement that just says "Object Required"

I want to be able to allow a user to edit this file in Excel and then I will read it to update the database with the changes they have made.


using schema.ini
I wrote a macro which write a table datas to csv file and I would like to use a schema.ini but this row doesn't work:

DoCmd.TransferText acExportDelim, "C:\p\Schema.ini", "t_le", "C:\p\sz.csv", True

the error message said: this string specification isn't.

a tried
DoCmd.TransferText acExportDelim, "Schema.ini", "t_le", "C:\p\sz.csv", True
DoCmd.TransferText acExportDelim, "Schema", "t_le", "C:\p\sz.csv", True
but the error message was the same


Allow user browse for file with TransferText?
I'm importing a CSV string using TransferText. I want a dialog box to pop up that allows the user to pick the file to transfer. How do I code the transferText option so that a browse dialog box pops up?


Importing A Text File
I'm trying to import a text file (semicolon delimited) into a table using the following code:

DoCmd.TransferText acImportDelim, , "tmp-orders", "url", True

However I get the error message
The file does not exist, or you do not have read access to the file The file is on a website and is there (I can view it in a browser).


Importing A Text File
I'm trying to import a text file (semicolon delimited) into a table using the following code:

DoCmd.TransferText acImportDelim, , "tmp-orders", "url", True

However I get the error message

The file does not exist, or you do not have read access to the file
The file is on a website and is there (I can view it in a browser


TransferText doesn't exist
I'm trying to create a macro to import a text file to my database and from what I can gather from my research, I should use TransferText.

I am using MS Access 2007 and TransferText does not exist in my list of actions when creating the macro.