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

x
?
Solved

Export Text File using Docmd.transfertext using criteria

Posted on 2014-01-15
8
Medium Priority
?
395 Views
Last Modified: 2014-01-15
I have it working except for limiting the text file to just the orgshop.  It Puts a text file in each folder correctly but doesn't limit the text file to the criteria orgshop.  attached is the function im using.  Any ideas?
Function.txt
0
Comment
Question by:Hiken
[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
  • 4
  • 4
8 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39782141
does this query "q01DOLI-WeaponsInUseExport" returns all ORGSHOP ?

- if it does, then you need a filter for each ORGSHOP for each export, by altering the querydef of your query  "q01DOLI-WeaponsInUseExport"  before exporting..

how many ORGSHOP do you have ?
0
 

Author Comment

by:Hiken
ID: 39782149
yes it returns all orgshops  what i want it to do is export each org shop in the query to a different folder.  i was able to do this with a report  like this:

DoCmd.OpenReport "r01R14", acViewPreview, , "orgshop= """ & ORGSHOP & """", acHidden

DoCmd.OutputTo acReport, "r01R14", "PDF Format(*.pdf)", locationR14 & ("R14-" & ORGSHOP & "-" & getDate & "-" & Format(Now(), "hhnn") & ".pdf"), False, ""


I want to do this exact same thing but with a txt file instead of a report
0
 

Author Comment

by:Hiken
ID: 39782206
oops didn't answer your last question I have 8 now, but it could change in the future  that's why I don't want to do a different query for each org shop
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 total points
ID: 39782234
you can use another recordset to filter the query

dim orgRs as dao.recordset

set orgRs=currentdb.openrecordset("select distinct orgshop from TableName")

do until rsOrg.eof

'here you can change the querydef of query "q01DOLI-WeaponsInUseExport"

' export codes here

rsOrg.movenext
loop
0
 

Author Closing Comment

by:Hiken
ID: 39783318
You did lead me in the right direction with querydef.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39783410
why a grade of C ?
0
 

Author Comment

by:Hiken
ID: 39783481
Didn't feel you gave me an answer just led me in the right direction.  If you check the  file I uploaded it was a lot more than what you gave me to get it done.  I was toying with a B though
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39783507
<Didn't feel you gave me an answer just led me in the right direction>

WOW...

good luck with project
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

636 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