I posted the question below but may have another option that is easier. I can export a table to a text file. I'll call it MyTextFile.txt. Now that I have the file exported to C:\PSWaiverFiles\MyTextFile.txt, I would like to rename it to a control on one of my forms. The control is Forms!frmDailyLogOptions!WaiverFile. The data in that field is something like M1111111.001. How do I rename C:\PSWaiverFiles\MyTextFile.txt to C:\PSWaiverFiles\M1111111.001?
I am familiar with vbs scripts and the Shell feature a little.
Thanks again.
PREVIOUS POSTING
I will be sending a flat file once a month by uploading it to the internet. It has a very explicit layout. I create a table, export it to a folder, and rename it. The naming convention is as follows:
M[ContractNumber].nnn
The nnn is a sequential set of numbers. I have a table that I use to create this file name with an update query. After running the process I will update the nnn number by 1 each time I send it. For example, the first file would be M111111.001. The second file would be M111111.002, and so on.
In testing the process, I put the table behind a form with the control buttons and added the field with the file name to the form. After testing I will hide the field. Here are the components of the process.
Form – frmDailyLogOptions
Table - tblWaiverBillingFileName
Control Name on Form – WaiverFile
Output Folder – C:\PSWaiverFiles\
I need help tweaking the code for the process. I have no trouble creating text files with this process. I am using the following to create and export the file.
DoCmd.TransferText acExportFixed, "WaiverFiles", "tblWaiverBilling", "C:\PSWaiverFiles\" & Forms!frmDailyLogOptions!WaiverFile, False, ""
I get a message that says “Cannot update. Database or object is read-only.” What do I need to do?
Thank you.
I am familiar with vbs scripts and the Shell feature a little.
Thanks again.
PREVIOUS POSTING
I will be sending a flat file once a month by uploading it to the internet. It has a very explicit layout. I create a table, export it to a folder, and rename it. The naming convention is as follows:
M[ContractNumber].nnn
The nnn is a sequential set of numbers. I have a table that I use to create this file name with an update query. After running the process I will update the nnn number by 1 each time I send it. For example, the first file would be M111111.001. The second file would be M111111.002, and so on.
In testing the process, I put the table behind a form with the control buttons and added the field with the file name to the form. After testing I will hide the field. Here are the components of the process.
Form – frmDailyLogOptions
Table - tblWaiverBillingFileName
Control Name on Form – WaiverFile
Output Folder – C:\PSWaiverFiles\
I need help tweaking the code for the process. I have no trouble creating text files with this process. I am using the following to create and export the file.
DoCmd.TransferText acExportFixed, "WaiverFiles", "tblWaiverBilling", "C:\PSWaiverFiles\" & Forms!frmDailyLogOptions!WaiverFile, False, ""
I get a message that says “Cannot update. Database or object is read-only.” What do I need to do?
Thank you.
Last edited: