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

Export Text File using Docmd.transfertext using criteria

Posted on 2014-01-15
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?
Question by:Hiken
  • 4
  • 4
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 ?

Author Comment

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

Author Comment

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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

LVL 120

Accepted Solution

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


Author Closing Comment

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

Expert Comment

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

Author Comment

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
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>


good luck with project

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

792 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