Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...just the few hours I've spent on this site I have learned a lot. I can now implement features that will be very useful to my company, and some of those I never knew existed..."

Geography

Where in the world do Tek-Tips members come from?
razchip (TechnicalUser)
28 Jun 12 16:22
I had a filesearch function in Access 2000, I've tried various things in 2010 and have had no luck. I look to see if a trigger file exist, if it does the program proceeds, if not, I show a warning and close the process (shown below). Is there an easy method to do this in 2010?

Set fs = Application.FileSearch
'Looks for the trigger file before it copies the files to C:\xxxxxx
With fs
.Lookin = "\\Path\CCCC\VVVV\BBBBB\NNNNNN"
.FileName = "K6empsts.trg"

If .Execute > 0 Then
Else
'DoCmd.OpenForm "NoTrigger", acNormal, acPreview
End If

Thanks.

Thanks for the help.
Greg

kjv1611 (TechnicalUser)
29 Jun 12 11:39
If your wanting to verify whether a file exists or not, and the move if it doesn't exist, then you could do something like:

CODE

Sub MoveMyStuff
   Dim f1 as String 'orig file path
   Dim f2 as String 'new file path

   f1 = "C:\MyNewFile.txt"
   f2 = "H:\MyFolderName\AnotherSubfolder\MyNewFile.txt"

   If Dir(f2) = "" Then 'File is not there, go ahead and move
      FileCopy f1, f2 'copy the file
   Else
      kill f2 'delete existing file
      FileCopy f1, f2 'copy the file
   End If
End Sub 

"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close