Wrox Programmer Forums
|
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
 
Old April 21st, 2005, 03:06 AM
Authorized User
 
Join Date: Apr 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default File Export in VBA

I need to export the result of q query to a text file. but the trick is that i need to limit each line by 150 character max. i think that i need to keep a counter of what i'm adding to the file. but any idea how???
thank you very much

 
Old April 21st, 2005, 11:37 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am not sure why you need to limit this, but you can do this by putting all the fields in your query into a variable for the line, and then passing the variable like this:

WriteLine Left(stMyVariable, 150)



mmcdonal
 
Old April 21st, 2005, 11:39 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

If you have the field names of the query, and the query name, and the text file name, we can help you write this. This should take about ten minutes.

Are you using ADO or DAO?


mmcdonal
 
Old April 24th, 2005, 01:48 AM
Authorized User
 
Join Date: Apr 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you for responding. yes i do have all of these.
i'm using DAO.
I apreciate your help. buti don't need to only chop off the end fothe line. what i need is to make sure that the line is only 150 characters long and that the fields within the line match up with their predefined lengths. so that if they're less than a certain length we need to add nulls and if they are more then we need to chop off the extras.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Vba Vbe Export Coby Excel VBA 2 January 25th, 2008 04:40 PM
scheduled export to XML file jjhm93 SQL Server 2005 2 December 15th, 2006 02:28 PM
Export To .csv File paul31Hampshire Access VBA 18 June 26th, 2006 11:30 AM
export to .txt file meimy Pro VB.NET 2002/2003 0 May 31st, 2004 02:24 AM
Export a file Discoverer Report to a .pdf file alozano Oracle 0 May 6th, 2004 10:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.