Export Text to Separate files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there

Is it possable to export text into separate files automatically according to
a set criteria. I have created a database for the management of handst
unlocking requests. One of the Manufacturers we deal with have provied us
with a system to generate the codes for their handsets. Over the past 3 years
we have 3 different systems 1 for olter model handsts 1 for models produced
within the last 2 years and now we have another for the new 3G handsets. I
have inclued a "code Sourcefield" in the handset type table. I use this to
query the requests and produce a list of serial numers accoring to code
source. I am having to export each batch manually into text files ready for
the code system.

I would like someting like Winlock4-Type2.txt, Winlock4-Type5.txt And
Winlock4-Type6.txt. (ready for import into the winlock systm)

Any help would be appreicated - thanks
 
It's possible, but just what's involved depends on just what the
situation is. Could be as simple as

1) create three queries, one that returns all the Type2, one all the
Type5 and the other all the Type6. Let's call them qryType2 etc.

2) put a commandbutton on your form, with something like this in it's
Click event procedure:

Dim strFolder As String

strFolder = "C:\Folder\Sub folder\"

DoCmd.TransferText acExportDelim, , qryType2, _
strFolder & "Winlock4-Type2.txt", True
DoCmd.TransferText acExportDelim, , qryType5, _
strFolder & "Winlock4-Type5.txt", True
DoCmd.TransferText acExportDelim, , qryType6, _
strFolder & "Winlock4-Type6.txt", True
 
Hi there,

Thanks for the reply, I have implemented the procedure as advised however
would it be possable to query the code source field and generate the filename
from there. It is possable Nokia may introduce handsets with a different code
profile to what we have already..

Many thanks
 
Quite possible, though it takes a lot more coding. It would go something
like this pseudocode, using one query whose SQL property you create as
needed:

Set R = OpenRecordset("SELECT DISTINCT CodeProfile FROM MyTable;")
Do Until R.EOF
strSQL = "SELECT * FROM MyTable WHERE CodeProfile ='" _
& R.CodeProfile & "' ORDER BY SomeField;"
dbD.QueryDefs("MyQuery").SQL = strSQL
DoCmd.TransferText blah "MyQuery" blah blah
R.MoveNext
Loop
R.Close
 
Back
Top