 |
Access VBA Discuss using VBA for Access programming. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

September 18th, 2003, 12:37 PM
|
Registered User
|
|
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Transfer Text/timing problem?
I am attempting to create 2 ASCII (fixed length) files from 2 tables in my database. The code isn't difficult, but it isn't working. My code looks like this:
MyFileName = "c:\NBDBR.TXT"
MyFileName2 = "c:\NBDBO.TXT"
Call DoCmd.TransferText(acExportFixed, "ExportReportsNBDB", "Reports", MyFileName)
Call DoCmd.TransferText(acExportFixed, "ExportOrdersNBDB", "Orders", MyFileName2)
This code works in the "immediate" window. It works when I step through in debug mode. However, when I run the module, I end up with 2 files of zero size. I am guessing it is not having time to complete the commands when running real-time. Can someone help me out with a timing loop or something? Or if I'm totally off-base, can you head me in the right direction? Thanks.
Lori
|

September 18th, 2003, 12:48 PM
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Lori,
I don't know how big are your tables. There is a limit within ACCESS but this is not the problem i think.
try to code this
DoCmd.OutputTo acTable, "mytablename", "MicrosoftExcel(*.xls)", "c:/my-tables/mytable.xls", False, ""
or DoCmd.TransferText acExportDelim, "", "mytablename", "c:\my-tables\mytable.txt", True, ""
you may create also a macro to do the same transfer.
Kind regards,
Bassam
Bassam Sater
|

September 18th, 2003, 01:04 PM
|
Registered User
|
|
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by Bassamsater
Hi Lori,
I don't know how big are your tables. There is a limit within ACCESS but this is not the problem i think.
try to code this
DoCmd.OutputTo acTable, "mytablename", "MicrosoftExcel(*.xls)", "c:/my-tables/mytable.xls", False, ""
or DoCmd.TransferText acExportDelim, "", "mytablename", "c:\my-tables\mytable.txt", True, ""
you may create also a macro to do the same transfer.
Kind regards,
Bassam
Bassam Sater
|
The tables vary in size; currently they contain 48 & 77 records.
If I understand your code correctly, it will produce either an Excel worksheet, or a comma-delimited ascii file. Unfortunately, neither of those will fit the bill. This is being FTP'd to an archaic system, and it will only accept the fixed-length format.
Lori
|

September 23rd, 2003, 02:56 AM
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry then, i never tried such a file transfer.
Bassam
Bassam
|

October 9th, 2003, 07:01 AM
|
Registered User
|
|
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Have you tried using the Print # method?
Grab a recordset of your table and loop through it, printing out to your file.
You get each line exactly as you want it then.
Janine
|

October 24th, 2003, 03:22 PM
|
Registered User
|
|
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by janineo
Have you tried using the Print # method?
Grab a recordset of your table and loop through it, printing out to your file.
You get each line exactly as you want it then.
Janine
|
Janine, you're brilliant. That worked much better than what I was trying. Thanks.
Lori
|

November 7th, 2003, 02:33 PM
|
Registered User
|
|
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Lori,
I have a process for uploading information to a mainframe through ftp using Access97 on a Windows 2000 machine. Following is what I have to write the text files:
DoCmd.TransferText acExportFixed, "CPCUpload Export Specification", "Upload", "I:\CPCUpload.txt", False, ""
Ron
|

November 7th, 2003, 03:52 PM
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ron, How do you upload it to the mainframe? I am interested on more info on this.
Sal
|
|
 |