Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old November 21st, 2008, 01:10 PM
Registered User
 
Join Date: Nov 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Automate Exporting data to text file if new record

New access user needing help! I'm thinking I need to create a module using VBA scripting to accomplish this task.

I have created a view of data from two tables and need to produce a line of text to a text file whenever data is populated in view from the tables. So I only need to create lines of output text for the new lines.

view DATA2Export

Field 1 Field 2 Field 3
------- ------ -------
11225 12TA8 C56

Output string to a file (i.e., C:\export.txt)
"11225","12TA8","C56"

This is being added to an Access97 database (that I can not convert to a newer version, without breaking the front end application).

Thanks in advance for your replies

  #2 (permalink)  
Old November 21st, 2008, 04:35 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I do something similar from one of my applications.

I create a text file for the day if one doesn't exist. I use the date in the text file name, and then check for the file using a known name for the day, and if it doesn't exist, I create it.

Then I open it and write one line to it using VBScript from Access. The psuedo code is like:

Create scripting file system object
Check if today's file exists
   If no, create today's file
   Write one line
   Close file
   If yes,
   open file
   write one line
   Close file

This doesn't include whatever you are doing to generate your one line.

I did another similar post on writing to a text file earlier this week. Find that to get started, or post back. I may not be able to get back till Monday.

Look up Scripting.FileSystemObject at MSDN as well.

mmcdonal

Look it up at: http://wrox.books24x7.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting data to PDF file using ASP m_soni21 Classic ASP Professional 1 September 16th, 2008 12:15 PM
Exporting cell values to text file vemaju Excel VBA 2 October 1st, 2007 02:30 PM
Exporting data into Excel file from SSIS atulmar Reporting Services 0 November 21st, 2006 09:35 AM
Exporting report to text file naruto-kun Reporting Services 0 August 15th, 2006 10:54 PM
Exporting Data from DataGrid to a CSV file PT ASP.NET 1.0 and 1.1 Professional 2 June 22nd, 2005 04:41 AM





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