Exporting values entered in a form to text a file (latest record only)...

kaisersose

Registered User.
Local time
Today, 03:19
Joined
Sep 25, 2008
Messages
13
Hopefully someone can help me with this. I'm trying to setup a simple form like in the example I have below:

ID [ 1234567 ]
Number of dvds [ 560 ]
Number of blu-ray [ 100 ]
Number of hd-dvd [ 50 ]
Total Films [ 1000 ]
Dvds % [ 56% ] this with be automatically calculated with the formula (Number of dvds / Total Films)
Blu-Ray% [ 10% ] this with be automatically calculated with the formula (Number of blu-ray / Total Films)
HD-DVD % [ 5% ] this with be automatically calculated with the formula (Number of hd-dvd / Total Films)

Submit Button

Now when the user hits the submit button, I want this record to be added to the database, but at the same time I want the figures here exported to a delimited text file (i just want the latest record in the txt file, so i'd want the text file wiped before it adds the newest record).

I've only started using access recently so bare with me! :)

I've got as far as setting up a form like my bad example above and adding the record to the database, but I'm lost for the next part where I want the record exported to a text file. I want this done automatically when the submit button is clicked, so manually exporting is not an option. And I have tried the transfer text macro, but that just exports all records from the table to a text file (I just want the latest record).

I want this all to happen when the user hits the submit button, so that its as easy as possible. The reason I want it exported to a txt file is that another program will read the values in.

If anyone has any ideas on how I can accomplish this or let me know if its not possible, it would be much appreciated.
 
The transfer text macro can be based on a query, all you need to do is create a query to select the last record entered in the table and put the query name into the table name setting of the macro.
 
thanks,

have the working ok now, only one more thing I need to do though, when the data exported to the text file, I only want the latest record displayed. At the moment it just keeps on adding lines which will be no use for what I want to do. Is there any way of wiping the text file before the text is exported using the same macro?

any help would be great
 
Not sure why, I have just tested this and it overwrites the file.
 
yep it does, dont know why it didnt work the first couple of times, I must have had something wrong

Anyways works fine now so thanks
 

Users who are viewing this thread

Back
Top Bottom