Solved

Export Text File using Docmd.transfertext using criteria

Posted on 2014-01-15
8
375 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 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

810 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