I have a dir list box


  'Kill (App.Path & "\PhoneTel.mdb")

  our = (Dir1.Path + "\" + File2.filename)
  mitt = Left$(File2.filename, 12) ' phonetel.mdb

  SourceFile1 = our                '
  DestinationFile1 = App.Path + "\" + mitt '"PhoneTel.mdb"

  FileCopy SourceFile1, DestinationFile1

as seen in the second image there is
i will that when a press the backup command it will go
direct to foldeer backup

Recommended Answers

All 6 Replies


You should check that Dir1.path is not equal to the App.path, are you having an issue with the code?

Problem with the code I have been trying evry way.
Can you help me Please

Dim mypath As String
Dir1 = "c:\TelbokEmailRecive & backup"
mypath = Dir1 
File2.Path = mypath

Hi I got it like this (dir1.jpg) but I will
have it like (dir.jpg) when they are going to
catch the backup files instead.

Still not sure what you are trying to achieve...
Do you mean you want to save the file in the directory?

This function would return the fullfilepath accounting for a file existing there already... The alternate would be to delete the existing file and save the new one.

function GetAvailableFilePath (byref Path as string, byref filename as String) As String
dim FullFileName as string
dim indx as integer = 1
dim Extn as integer = instrRev(filename, ".")
'ensure ends with \
if Right(Path,1) <> "\" then
    Path = Path &"\" 
end if

FullFileName = Path & filename
if Dir(FullFileName) <> "" Then
    'file Exists - assuming you wish to not overwrite:
    While Dir(FullFileName) <> ""
        'Keep incresing indx and adding to file name until we have no match
        FullFileName = Path & left(filename, extn-1) &"(" &indx &")" & mid(filename, extn)
        indx = indx+1
end if

Return FullFileName
end function

Not to save the file have I already done automatic.

As what I will is that when the user press button ( Getbackup)
the file list box should just point to
app.path\backup or go to app.path\backup\backup
and there select the file they will use.
Nothing else should bee visible Just this 2 directories

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.