Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MS Access and VB Script

Posted on 2011-02-21
2
Medium Priority
?
279 Views
Last Modified: 2012-08-13
Hi Experts,

I have an access database which has two tables “Current_Year” and “Prior_Year”.  I would want a vb code to help me split the table in various text files based on the account number at a selected or given location. So I would end up with two text files one for Current Year table and another for Prior year table and the files should be placed in a folder at the destination given with folder name as the account number.
Thanks a lot in advance.

Regards,
Sai
Test-.mdb
0
Comment
Question by:Saichand
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85
ID: 34945978
Can you show what you've attempted so far?

You can "split" a table by using queries. For example:

SELECT * FROM YourTable WHERE Year(YourDateField) = 2010

To do this, Create a new query, select your Table, and add all the fields you need to show in the Text file. You'll need to add a Calculated column to your query as well. To do that, move to a blank "column" in the query grid, and enter this in the "Field" row:

MyYear: Year([YourDateField])

This will create a column named "MyYear". You can then set a criteria on that column:

=2010

This will filter all the data in that table for any value where Year of your Date field = 2010. Save that query, and use it below.

From there, you can use the builtin Export functions of Access to move the data to a Text file. In 2007/2010 you would select the External Data tab - Export group - Text files. This brings up a wizard you can use to export that data to a standard TXT file.
0
 
LVL 6

Accepted Solution

by:
TinTombStone earned 2000 total points
ID: 34946247
I have modified Test.mdb to include a form that does what you asked
Give it a go, see what you think

Test-.mdb
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question