Topics Search

DoCmd.TransferText only if file is new

DoCmd.TransferText only if file is new
Views: 25
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:

More topics

 

DoCmd.TransferText VBA versus Wizard

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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.