Create a text file from Access

I

Ian King

My database has a form that opens only on the first use of the programme.

This form generates a key based on the data entered on it.

I want to save that key outside the database in a text file in the CurrentDb
folder. I dont want to export a table or query as text, just the calculated
key.

Can anyone help with a bit of code to enable this?

Many thanks

Ian King
 
A

Allen Browne

You will need to use VBA code.

In the code window, see help for Open, Print #, and Close.
You are opening For Output.

If you don't know anything about code, it may be possible to craft a query
that returns just one row and just one column, matching the value of the
assigned control on your form. Then use TransferText (in code or a macro) to
export that single value to a text file.
 
G

Guest

Open "D:\TestFile.txt" For Output As #1
Print #1, "YourKeyValue"
Close #1

D:\TestFile.txt will be automatically created/overwritten.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top