Solved

Export Text File using Docmd.transfertext using criteria

Posted on 2014-01-15
8
386 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 120

Accepted Solution

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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.
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.

738 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