> i'm trying to create a *.TXT file as an archive from the results of a select
> query before a delete query wipes out the information.
This is the syntax of the SQL query to save a SELECT query as a text file:
SELECT ID, Junk, FromDate
INTO [Text;HDR=YES;DATABASE=C:\Work\].Stuff.txt
FROM tblStuff
WHERE (ID<20);
The resulting text file will be C:\Work\Stuff.txt and will contain three
columns of data, ID, Junk, and FromDate. The formatting of the data types
will be automatic, since Jet will automatically create a Schema.ini file in
the destination directory.
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
"Joe Mills" <JoeM...@discussions.microsoft.com> wrote in message
news:11EC37E7-3986-4E0B...@microsoft.com...
"'69 Camaro" <ForwardZERO_SP...@Spameater.orgZERO_SPAM> wrote in
message news:79BD90E4-5F72-4131...@microsoft.com...
Happy New Year!
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
"David F Cox" <nos...@please.com> wrote in message
news:%23YDe7x$KHHA...@TK2MSFTNGP04.phx.gbl...
in CodeLine1 do i have to spell out every field with a comma in between?
that could take awhile since the query selects all the fields from six tables
most of which have more than 20 fields.
this way when i screw things up i'll have a better idea of where to fix it.
Don't think of it as four lines of code: it's a single SQL statement that
Gunny chose to display on four lines. No offense, but if you're going to
work with Access, you really should learn SQL.
To adapt it to your situation, create a query that returns all of the data
you want. Yes, you should specify specific fields, rather than use SELECT *,
in your query. Once the query is working how you want it to, go into the SQL
of the query (look under the View option on the menu when you've got the
query open) and add the text
INTO [Text;HDR=YES;DATABASE=C:\Work\].Stuff.txt
before the FROM keyword of the query.
As you supposed, the INTO keyword tells Access to store a copy of the data
retrieved "somewhere". The "somewhere" is defined by the combination of
what's in square brackets and the .Stuff.txt afterwards. What Gunny's got
will create a file named C:\Work\Stuff.txt that contains the data.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Joe Mills" <JoeM...@discussions.microsoft.com> wrote in message
news:7E1063F3-CCF6-46C9...@microsoft.com...
If it does, you're fine. If it doesn't, post back with what didn't work, and
we'll see what we can do.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Joe Mills" <JoeM...@discussions.microsoft.com> wrote in message
news:1A686ED2-968A-4EB7...@microsoft.com...
I think Gunny's INTO option can be made to work - but if you have
trouble with it, take a look into using VBA code with the TransferText
method to export the data to a text file. Open the VBA editor and look
for help on TransferText.
John W. Vinson[MVP]
"Joe Mills" <JoeM...@discussions.microsoft.com> wrote in message
news:BDF023C1-D1C6-488E...@microsoft.com...
What's the exact SQL you're trying to run now?
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Joe Mills" <JoeM...@discussions.microsoft.com> wrote in message
news:BDF023C1-D1C6-488E...@microsoft.com...
The location of the closing square bracket is important: the folder name
goes inside the square brackets, but the file name is outside (with a period
in front of it)
You may have to put the actual field names in, though. Access will be
creating a file named schema.ini in the same folder as the text file, and
I'm not sure whether it will accept the * instead (sorry, too lazy to test)
And sorry I can't help you with your question about unauthorized
duplication. What databases I design at work are the property of the
company, not me, and what code I post on the internet, on my website and in
the articles I write, I don't care if others use it.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Joe Mills" <JoeM...@discussions.microsoft.com> wrote in message
news:FE6BC453-8E55-4C53...@microsoft.com...
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:ui39%235ELH...@TK2MSFTNGP06.phx.gbl...
>i'm wondering if i'm just wasting all your valuable time (the need for a
>backup). the user has to confirm the delete anyway so if it's gone, tough
>crap it's their problem?
Two suggestions:
Keep regular backups (several layers deep ideally) of the entire
database.
Or... don't delete records at all; just add a yes/no field Active
defaulting to Yes, set it to No, and filter your forms to show only
active records.
Extracted text files are a hassle to manage!
No words of wisdom about securing your database, other than to
distribute only compiled MDE files and keep the MDB for yourself.
John W. Vinson[MVP]
> how do the pros like yourself protect your
> applications from unauthorized duplication?
I don't. I own the apps or the client owns the apps. The clients
sign agreements that spell out what distributionrights they have
(which is always NONE).
> are there copywrite issues i
> need to be aware of? i'm obviously a new developer and want to
> cover my financial butt. the application i'm writing has the
> potential to be sold to literally thousands of institutions
> (happened to stumble on a nationwide problem that this will solve)
> and i, naturally, want the credit. would i sell it as a license
> agreement? if so, your thoughts on fees? thank you for your
> interest
You could print the customer name on all reports. In an MDE this
couldn't be changed.
You might want to look at this page:
http://www.frez.co.uk/freecode.htm
and look for the "Create and Validate License Keys." That will allow
you to distribute apps that won't function without a valid license
key from you. I'm working on a way to tie that to the location where
it's installed. Should I work that out, I'll post about it.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
I had to delete stuff.txt between tests, Access would not overwrite the old
file. It would not overwrite schema.ini either, it just re-used the existing
one without any warning, leading to much bewilderment, as each test produced
the same result.
I have not been able to find any documentation for this writing TXT files
feature. The syntax does not appear natural to me. I suspect that there are
hidden depths to this feature and would like to find a write-up.
> I suspect that there are hidden depths to this feature and would like to find
> a write-up.
For the syntax in your schema.ini file, you'll find the specifications and
information for using text files with Access on these Web pages:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjetschema_ini_file.asp
http://support.microsoft.com/default.aspx?scid=155512
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
"'69 Camaro" <ForwardZERO_SP...@Spameater.orgZERO_SPAM> wrote in
message news:%23wgtf0K...@TK2MSFTNGP03.phx.gbl...
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
"David F Cox" <nos...@please.com> wrote in message
news:uT1MMBLL...@TK2MSFTNGP02.phx.gbl...