Topics Search

Change the extension on a .csv file created in Access VBA....

Change the extension on a .csv file created in Access VBA....
Views: 13
Here's my issue, I'm creating a .csv text file using DocmdTransferText, problem is my target application needs it's csv files to have the extension .FAC and it's very fussy about that. I've tried altering the target output file to a .FAC one but get a 'Object is read only or cannot be written to' error, or exporting with the extension .FAC, but access doesn't seem to support a .FAC extension when using TransferText.

So I thought, why not add some code to the end of the sub that says once my .csv file has been created in C:\\My Dcouments, then select that file, say test.csv and rename it as test.FAC

Does anybody have an access vba code snippet that can do this
Sponsored Links:

Similar posts...


Test File Extension

Test File Extension Icon
Just joined and looking forward to hearing from everyone.!
Here's my first Access VBA question:

I have three types of files under certain directories ie. *.log, *.csv and *.txt
Hopefully, while inside an If statement, I'd like to test the extension of the files it has encountered.Then, after the test is satisfied, I would like the code to exit the if statement and go to another public function to import the file extension it has found.
I'm just learning vba, so

Import a file with no extension

Import a file with no extension Icon
I am trying to write a macro that will import a file. The file is created from a mainframe export and the file does not have a file extension. I am using Access 2007 and it will not let me import from a file that does not have one of the standard extensions and gives an error of such when I try. I am trying to create a process that does not require manually having to change the file in any way prior to importing into my Access table. Is there a work-around that will allow me to import this file on a monthly basis without having to manually add a file extension to the file first

Save csv file as excel

Save csv file as excel Icon
I need to import data from csv files into Access.

The problem that I have is that the format of the cvs file can change. Some have 5 columns od data, some have 6. Also the contents of the first row change!

I can handle the changes in the data if the data is available in an Excel spreadsheet.

How can I save a .csv file as an Excel file using vba (DAO)?

Or do I need to open the .csv file and import the data row for row? If yes,

vba to retrieve data from csv file to auto-populate

vba to retrieve data from csv file to auto-populate Icon
Do you know of any vba I can use that once I click on a button (vba coded) can retrieve data from a csv file and autopopulate in a table I was wondering if it was possible to create a complex button using the file \\Cluster2\Dept Data\Migration Data\NOMSALES.csv as a source and from that create a csv file that displayed sample data from the file [LINK] Data\MigrationData\NOMSALES Output.csv.

In other words instead of the user going through a directory to open a file I would like the user to click on a button within an access form and the data within the later file will automatically populate in a table. Can this be done?

Executing .BAT file from Access

Executing .BAT file from Access Icon
I have a database setup with a macro that imports a Dir.txt file that is originally created by a Dir.bat file that I created in a folder. I basically click on this .bat file that creates a directory of all files in that specific folder with a .tif extension and actually removes that extension once the dir.txt file is created.

I basically want to have Access run the file automatically instead of having someone remember to run it first. Another problem is that Access needs to wait until the .bat file is finished running. How can I accomplish this? I really don't have that much experience with VBA but I'm sure with some help from all of you I can accomplish this.

Importing a CSV file with VBA

Importing a CSV file with VBA Icon
I'm importing a standard CSV file into access using the following VBA:

DoCmd.TransferText acImportDelim (file specs/location follow)

For some reason, access is adding a .00 at the end of a text field (it's a text field but the data is a number). Does anyone know why this is happening? I've been using this same VBA every day with no issue until today. The field/column is formatted as text once it's in the table in access but now with the .00 at the end of every record. For example, the CSV file shows the field value as 011163, and once imported it shows

Make hyperlink to a file without using extension?

Make hyperlink to a file without using extension? Icon
Is it possible to follow a hyperlink to a file without using a file extension? I have links being created based on the name of a file, but because I haven't used a file extension it crashes. I know I can give the user a choice of what the file extension is and add it to the hyperlink, but it's an extra step, I'm potentially using 3 different file types, Word, Excel and PDF's.

The hyperlink works if I just reference a drive/folder, or if I add the file extension.

How to import or export CSV file to and from Access?

How to import or export CSV file to and from Access? Icon
I wanted to import and then export CSV file to and from access but couldn't know how can I do that directly.

Is there a way to do that?

do I need all the time to have a "Broker" extension to accomplish this?

Automatically export Access report

Automatically export Access report Icon
I have created a report in my Access 2003 database, which pulls through a few columns from a Query. However I need to output this to a .txt or .csv document. If I right click my report and press Export and save as a .csv etc, I get exactly what I want.

However I would like to know if there is a way this can be done Automatically, either by VBA or a bat script.

Basically at 08:00am every morning I want to export my data the report onto a text or csv file.

From there I will be running into third party software to format and e-mail it to the desired people.

export as csv file

export as csv file Icon
I have a file I created in Access. I export it as a text file. When I load open it as a csv file it looks fine but when I save it and reopen, it has changed some of my data. (Drop zeros,displays field in scientific format) How can I convert a text to csv without changing my format?

(I have never had so many problems in one database in my life)