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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename Dir

Status
Not open for further replies.

bubba100

Technical User
Nov 16, 2001
493
US
Hi all. I am trying to rename a directory with the following. It gives an error message "path/file access error" on line "Name OldName AS NewName". I am trying to change the folder name holding a BE file before relinking to that file. If I hold the cursor above Name if get the name of the form that is open. Trying to use the Name Statement of the Dir function, but guess I don't understand it fully. Thanks for any advice in advance.


Dim sFileName As String
Dim OldName, NewName
Dim appAccess As Access.Application
Dim DBS As Database
Dim rst As Recordset
Dim tdf As TableDef
Dim tdfs As TableDefs
Dim RefreshLinks As Boolean
Dim tableName As String
Dim tdfNew As TableDef
Dim dbs2 As Database
Dim fld As Field
Dim prpLoop
commondialog1.InitDir = "C:\My Documents"
commondialog1.Filter = "All DataBase Files (*.mdb)|*.mdb"
commondialog1.Flags = &H1000& Or &H800&
commondialog1.FilterIndex = 1
commondialog1.DialogTitle = " Select The Taxpayer File That You Want To Continue. "
commondialog1.ShowOpen
sFileName = CurDir(CurrentDb.Name)
OldName = sFileName
NewName = Left(OldName, 16) & "S" & Mid(OldName, 17)
Name OldName As NewName
 
MircosoftVisualBasicHelp said:
Using Name on an open file produces an error. You must close an open file before renaming it. (?) wildcards.
You are trying to rename the currentdb that is open
 
That is what is confusing the BE is not open. There is no ldb file in the BE folder and the tables have not been relinked. I looked at the task manager and only one MSAccess.exe is running.
 
You are trying to rename the current directory !

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That is my problem. I need to capture the name of the folder before it becomes the current directory. Back to the drawing board.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top