473,396 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Regarding DoCmd.TransferText

1
Hello,
I'm using Access 2002-2003. My application exports an Access table into a text file and then appends the text file with several othet files to generate a final file XXXX.ftm .

Issue:
One of the field in my access table has a type TEXT and length 255. I enter a string value "OMSI-2" which is 6 char long.
Via two steps this field end up in NLNVM.FTM and there it becomes 8 char long (the string OMSI-2 + 2 spaces).

the two steps are:

1. function Exportone (in VB) exports data from table ocsda to ocsda.txt

2. appends ocsda.txt + other files to nlnvm.ftm

Function ExportOne(strTbl As String, strDir As String, strExt As String) As Boolean
On Error GoTo ExportOneErr

DoCmd.TransferText A_EXPORTFIXED, strTbl, strTbl, strDir + "\" + strTbl + strExt
ExportOne = True

ExportOneExit:
Exit Function
ExportOneErr:
Debug.Print Error$
gsaddtolog "ERROR: Export " & strTbl & " mislukt!", gfGetConfigItem("LOG", "DirFile"), gfGetConfigItem("LOG", Err.Description)
ExportOne = False
Resume ExportOneExit
End Function

I'm not able to find why is this happens. Is this is something to do with this textTransferType "A_EXPORTFIXED". Plz help me. Thanking You
Feb 15 '08 #1
1 3272
Stewart Ross
2,545 Expert Mod 2GB
Hello,
I'm using Access 2002-2003. My application exports an Access table into a text file and then appends the text file with several othet files to generate a final file XXXX.ftm .

Issue:
One of the field in my access table has a type TEXT and length 255. I enter a string value "OMSI-2" which is 6 char long.
Via two steps this field end up in NLNVM.FTM and there it becomes 8 char long (the string OMSI-2 + 2 spaces).

the two steps are:

1. function Exportone (in VB) exports data from table ocsda to ocsda.txt

2. appends ocsda.txt + other files to nlnvm.ftm

Function ExportOne(strTbl As String, strDir As String, strExt As String) As Boolean
On Error GoTo ExportOneErr

DoCmd.TransferText A_EXPORTFIXED, strTbl, strTbl, strDir + "\" + strTbl + strExt
ExportOne = True

ExportOneExit:
Exit Function
ExportOneErr:
Debug.Print Error$
gsaddtolog "ERROR: Export " & strTbl & " mislukt!", gfGetConfigItem("LOG", "DirFile"), gfGetConfigItem("LOG", Err.Description)
ExportOne = False
Resume ExportOneExit
End Function

I'm not able to find why is this happens. Is this is something to do with this textTransferType "A_EXPORTFIXED". Plz help me. Thanking You
Hi. TransferText is indeed being told to export in fixed width, as you thought. It is really for importing or exporting structured text files that represent records where field boundaries are either delimited (comma-speparated or similar) or fixed-width. Couldn't easily determine where one field ends and the next begins otherwise.

When you read your text field back from the finished file you can always lose the extra spaces by using the RTrim function to remove them automatically. It would avoid rewiting your export routine.

RTrim is very simple to use - instead of referring to the field itself, refer to RTrim([field]).

Regards

Stewart
Feb 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Teresa | last post by:
I'm trying to import a tab delimited text file. The text file does not have column heading. I can give it column heading if needed. How do I change the defult comma delimited to tab? If I...
3
by: holdemfoldem | last post by:
Hi. I'm new to this board and have a few questions about using the method referred to in the topic of this message. I have manually transferred over 1/2 million records from a text file into my...
0
by: Chris | last post by:
Hi, I am using the command below for exporting data to text file. One of the query columns has SINGLE number type with decimal ponts as auto. DoCmd.TransferText acExportDelim,...
1
by: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. ...
14
PEB
by: PEB | last post by:
Hi all, Yesterday i've tried this command: DoCmd.TransferText acExportDelim, "Comma_SEP", "myquery", "D:\Temp\Temp.txt" And it gave me an Error that can't find "D:\Temp\Temp.txt" This...
1
by: veaux | last post by:
I'm sure this has been answered, and I've looked but can't quite find what I'm looking for. I have Path = "I:/voucher.txt" DoCmd.TransferText acExportFixed, "voucher_fixed",...
3
by: ProteusGak | last post by:
Hi there, can anyone tell me how to allow the user to enter in a path on there harddrive for a transfertext item? It works just fine if I set it programmatically, but I really need them to do this,...
4
by: jessek | last post by:
I’m trying to use DoCmd.TransferText, (I use it successfully with a .txt export every day) to export a table into a CSV file. Right now every time I try – it says: Run-time error 3011 The MS...
0
by: Cuaracao | last post by:
This is my code: Code1: 'DoCmd.OpenTable "tblImport" 'DoCmd.TransferDatabase acExport, "dBASE IV", strOutputDir,acTable,"sel_TblImport", strDbfName & ".dbf", False ' DoCmd.Close acTable,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.