Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change file names/path automatically! from a NEWGUY 2

Status
Not open for further replies.

tormented

Technical User
Sep 7, 2003
16
CA
I am brand new to this site so please let me know if I am doing anything incorrect.

I am looking for some help in the way my report gets filed.I currently can send a specific record of my report to a file. IE C:filename.rtf , but I would like to change my file name automaticallly every time I click on my "file report" command button.
IE C:filename2.rtf,C:filename3.rtf,C:filename4.rtf and so on and so on.

I don't want to delete or overwrite the first file C:filename.rtf however.

Any help would be appreciated.Thank-you.

Tormented
 
Why not create a table to hold the 'count' of files written, increment the number each time you write a file.
 
Hi Tormented

First, place an unbound textbox on your form. Set its value to '1'. Now, make it hidden so that it does not appear to the user.

Next, go into the
Code:
OnClick
for your report button and alter the naming of the file. Assuming its hardcoded at the moment to be filename.rtf, change it to something like
Code:
stFilename="whateveryouchoose" & Me.MyHiddenTextBox

This will concatenate the filename you choose with the numeric value which is in your hidden textbox.

The last step is to put some more code in
Code:
OnClick
, to increment the value in your hidden textbox by one.

So
Code:
Me.MyHiddenTextBox=Me.MyHiddenTextBox + 1

Next time you click the report button, the new number will be appended to the filename and your previous reports will be retained.

Hope this helps!

Mac
 
To Mac,

Thank-you, thank-you and thank-you. A star for you!!!!!! Much appreciated for the help. I hope someday I will be able to return the favor.[2thumbsup]


To Jjob,

Thank-you for your input as well!!

Thanks
Tormented

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top