Change a file name using access 2007 form

  • Thread starter Thread starter LarryE
  • Start date Start date
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.
 
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
 
Back
Top