Change a file name using access 2007 form

L

LarryE

I have a form that I want the user to input a new file name into. Then I want
to use the Name oldfilename As newfilename action to change the name of an
existing file name to the newfilename. I cannot understand how to have the
Name action read the newfilename information from the table or the input form
field. Does anyone know how to change a file name using an access 2007 input
form?

Thank you very much.
 
S

Stuart McCall

LarryE said:
I have a form that I want the user to input a new file name into. Then I
want
to use the Name oldfilename As newfilename action to change the name of an
existing file name to the newfilename. I cannot understand how to have the
Name action read the newfilename information from the table or the input
form
field. Does anyone know how to change a file name using an access 2007
input
form?

Thank you very much.

Say your existing file is "c:\temp\myfile.txt" and your input control is
txtInput, the syntax will be:

Name "c:\temp\myfile.txt" As Me.txtInput

or (more exactly) :

Name "c:\temp\myfile.txt" As Me.txtInput.Value

Note that the above code expects to be executed in the form's module. If you
want to do this from a separate module, the syntax is:

Name "c:\temp\myfile.txt" As Forms!MyFormName.txtInput
 

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