Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

Move files and prompt user if overwriting existing file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 22 May 2007 16:56 GMT
I have the following code which is using the copy and kill command to
move files from one folder to another. It worked pretty good for
private use, but now I need it in the office and I would need to
prompt the user in case the file already exists.

My code so far:

Private Sub Command9_Click()
Dim strNewName As String
Dim strOldName As String
Dim strtargetfilepath As String

'defines where to look for the target filepath'
  strtargetfilepath = DLookup("[Draft to Active]", "filepath")

'takes the name and path of the file of a continuous form'
  strOldName = Me.Filename

'adds the old file name to the target filepath'
  strNewName = strtargetfilepath & "\" & Me.Name1

  FileCopy strOldName, strNewName

  Kill strOldName

End Sub

I need something that checks if the new filename (target filepath +
Name1) is already there.

Can anyone help me?
Douglas J. Steele - 22 May 2007 22:11 GMT
If Len(Dir(strNewName)) > 0 Then
' File exists
Else
' File does not exist
End If

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have the following code which is using the copy and kill command to
> move files from one folder to another. It worked pretty good for
[quoted text clipped - 27 lines]
>
> Can anyone help me?
Mike - 23 May 2007 05:11 GMT
On 22 Mai, 17:11, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> If Len(Dir(strNewName)) > 0 Then
> ' File exists
[quoted text clipped - 39 lines]
>
> - Zitierten Text anzeigen -

Hi Doug, thanks for the help. I posted my question unfortunately twice
(see URL).
Our IT department had some problems during the day so I couldn't see
what I had already posted and then posted it again.
So here's the URL:
http://groups.google.com/group/microsoft.public.access/browse_frm/thread/efcd9c1
26a7bdd07/708eadfd435887b0?lnk=gst&q=move+files&rnum=6#708eadfd435887b0

Unfortunately I don't know better how to refer to another thread.

Thanks again, Mike
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.