Solved

Export Text File using Docmd.transfertext using criteria

Posted on 2014-01-15
8
370 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
  • 4
  • 4
8 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
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
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Closing Comment

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

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now