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!

FileCopy with aslight difference

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
I am trying to use the following to copy a file...

Dim Location As String
Dim Destination As String

Location = frmMain.txtFolder(0).Text & "\xtrain.mdb"
Destination = frmMain.txtFolderDes(1).Text & "\xtrain.mdb"

FileCopy Location, Destination

...But I'm not sure how to take those values so that FileCopy accepts it and copies... any ideas????

Many Thanks... ;o)
 
I've solved it thanks... the destination text box was set as E:\ but it wouldn't accept the \ at the end...

How would I set it so that it removes the \ if the destination is just a drive letter? It works fine if you go further into the directory and choose a folder but not as a drive letter...

Thanks
 
Easy,


if Right(frmMain.txtFolder(0).Text,1)="\" then
Location = frmMain.txtFolder(0).Text & "xtrain.mdb"
Else
Location = frmMain.txtFolder(0).Text & "\xtrain.mdb"
EndIf

If Right(frmMain.txtFolderDes(1).Text,1)="\" Then
Destination = frmMain.txtFolderDes(1).Text & "xtrain.mdb"
Else
Destination = frmMain.txtFolderDes(1).Text & "\xtrain.mdb"
EndIf

I have some nice code to do a file lookup using the WINDOWS File opean api if you are interested.


Bill Paton
william.paton@ubsw.com

Check out
 
Thanks WP for your help... sorry to be a nuisance but could you please describe what the code does (i.e. what each bit of the code does)...

I'm quite new to VB so this would be appreciated...

Thanks Again...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top