|
-
Sep 9th, 2010, 01:00 PM
#1
Thread Starter
Member
[RESOLVED] Moving of file using command Button
i am trying to moving a file using this Code
1 Code:
'Dim strFileName As String
'upload file link into database
'cdlUpload.DialogTitle = "Upload File"
'cdlUpload.Filter = "All Files(*.*)|*.*|Office Document 1997-2000(*.doc)|*.doc|Office Document 2003-2010(*.docx)|*.docx|"
'cdlUpload.Flags = cdlOFNFileMustExist + cdlOFNPathMustExist
'On Error GoTo ERR_Handler
'cdlUpload.ShowOpen
'strFileName = cdlUpload.FileName
'FileSystem.FileCopy(strFileName, "C:\Documents and Settings\Fadairo Fussy Fisayo\Desktop\my very new project\Server") = = (strFileName)
'ERR_Handler:
' Exit Sub
but i dont know why its not working..
please i need assistance..
-
Sep 9th, 2010, 01:38 PM
#2
Re: Moving of file using command Button
Your FileSystem.FileCopy syntax has some issues. To find what it is compare what you have vs this sample code:
Code:
Private Sub Command1_Click()
Dim strSourceFileName As String
Dim strDestination As String
On Error GoTo ERR_Handler
'upload file link into database
cdlUpload.DialogTitle = "Upload File"
cdlUpload.Filter = "All Files(*.*)|*.*|Office Document 1997-2000(*.doc)|*.doc|Office Document 2003-2010(*.docx)|*.docx|"
cdlUpload.Flags = cdlOFNFileMustExist + cdlOFNPathMustExist
cdlUpload.ShowOpen
strSourceFileName = cdlUpload.FileName
strDestination = "C:\test\" & Mid(strSourceFileName, InStrRev(strSourceFileName, "\") + 1)
If Not Dir(strDestination) = "" Then
If MsgBox("Destination file alreay exists. Would like to override existing?", vbYesNo + vbDefaultButton2, "Confirm File Copy") = vbNo Then
Exit Sub
End If
End If
FileSystem.FileCopy strSourceFileName, strDestination
Exit Sub
ERR_Handler:
MsgBox "An error has occured while copying file. Operation aborted.", vbExclamation, "File Copy Error"
Err.Clear
End Sub
-
Sep 9th, 2010, 04:48 PM
#3
Thread Starter
Member
Re: Moving of file using command Button
[QUOTE=RhinoBull;3879722]Your FileSystem.FileCopy syntax has some issues. To find what it is compare what you have vs this sample code:
[code]
Private Sub Command1_Click()
Dim strSourceFileName As String
Dim strDestination As String
On Error GoTo ERR_Handler
'upload file link into database
cdlUpload.DialogTitle = "Upload File"
cdlUpload.Filter = "All Files(*.*)|*.*|Office Document 1997-2000(*.doc)|*.doc|Office Document 2003-2010(*.docx)|*.docx|"
cdlUpload.Flags = cdlOFNFileMustExist + cdlOFNPathMustExist
cdlUpload.ShowOpen
strSourceFileName = cdlUpload.FileName
strDestination = "C:\test\" & Mid(strSourceFileName, InStrRev(strSourceFileName, "\") + 1)
If Not Dir(strDestination) = "" Then
If MsgBox("Destination file alreay exists. Would like to override existing?", vbYesNo + vbDefaultButton2, "Confirm File Copy") = vbNo Then
Exit Sub
End If
End If
FileSystem.FileCopy strSourceFileName, strDestination
Exit Sub
ERR_Handler:
MsgBox "An error has occured while copying file. Operation aborted.", vbExclamation, "File Copy Error"
Err.Clear
End Sub
Thanks man so if i use this code
2 Code:
strSourceFileName = cdlUpload.FileName
strDestination = "C:\test\" & Mid(strSourceFileName, InStrRev(strSourceFileName, "\") + 1)
it will send the File to the location?? wat about if i want just the File name of the Copied file to show on another form and i will be able to redirect (like download) given file into the desktop of my come???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|