R
RJF
Using VBA in Access, I need to export 2 queries to txt files, then append the
2 txt files together. In this case, I can't use a union query and then
export the data because they are totally different formats.
Exporting the 2 files is not a problem. I’m using:
strSaveFileName_Copy = [Forms]![frm_ClientConv]!txt_FilePath & "R" & YYMM_01
& "00_Copy.txt"
strSaveFileName_Fax = [Forms]![frm_ClientConv]!txt_FilePath & "R" & YYMM_01
& "00_Fax.txt"
strSaveFileName = [Forms]![frm_ClientConv]!txt_FilePath & "R" & YYMM_01 &
"00.txt"
DoCmd.TransferText acExportFixed, "Copy_Export_Spec", "qry_Copy",
strSaveFileName_Copy
DoCmd.TransferText acExportFixed, "Fax_Export_Spec", "qry_Fax",
strSaveFileName_Fax
After this I get the correct separate txt files exported: R090200_Copy.txt
and R090200_Fax.txt
I found this code on-line to append these, but it's not working and I can't
figure out why.
I created a .bat file called merge.bat as follows and stored it in the
following directory: G:\Code\File_Conversion
"Copy strSaveFileName_Copy + strSaveFileName_Fax strSaveFileName"
(I tried using double quotes around the statement above and not using them
and neither worked)
Then in the VHB code, after I export the 2 files, I use this:
Shell "G:\Code\File_Conversion\merge.bat"
DoEvents
This code does nothing for me. I expected it to create a txt file called
R090200.txt then copy R090200_Copy.txt and R090200_Fax.txt into it.
Can anyone tell me what I'm doing wrong?
It will be greatly appreciated.
Thank you,
Rach
2 txt files together. In this case, I can't use a union query and then
export the data because they are totally different formats.
Exporting the 2 files is not a problem. I’m using:
strSaveFileName_Copy = [Forms]![frm_ClientConv]!txt_FilePath & "R" & YYMM_01
& "00_Copy.txt"
strSaveFileName_Fax = [Forms]![frm_ClientConv]!txt_FilePath & "R" & YYMM_01
& "00_Fax.txt"
strSaveFileName = [Forms]![frm_ClientConv]!txt_FilePath & "R" & YYMM_01 &
"00.txt"
DoCmd.TransferText acExportFixed, "Copy_Export_Spec", "qry_Copy",
strSaveFileName_Copy
DoCmd.TransferText acExportFixed, "Fax_Export_Spec", "qry_Fax",
strSaveFileName_Fax
After this I get the correct separate txt files exported: R090200_Copy.txt
and R090200_Fax.txt
I found this code on-line to append these, but it's not working and I can't
figure out why.
I created a .bat file called merge.bat as follows and stored it in the
following directory: G:\Code\File_Conversion
"Copy strSaveFileName_Copy + strSaveFileName_Fax strSaveFileName"
(I tried using double quotes around the statement above and not using them
and neither worked)
Then in the VHB code, after I export the 2 files, I use this:
Shell "G:\Code\File_Conversion\merge.bat"
DoEvents
This code does nothing for me. I expected it to create a txt file called
R090200.txt then copy R090200_Copy.txt and R090200_Fax.txt into it.
Can anyone tell me what I'm doing wrong?
It will be greatly appreciated.
Thank you,
Rach