Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search to see if file exists (A2K)

    I've created a command button on my database to create a backup of my back end daily. Unfortunately, this requires my users to be smart enough to click the button once a day (between 10 of them, you'd figure one would find it a good idea, however I've yet to have one do it.) Is it possible to have my database search to see if a File exists in a specific location, and if the file exists, do nothing, but if it does not exist, run the backup code? I would like to search for the file:
    XXX.XXX.XX.XXsharedatabasenew_folderBackup" & Format(Date, "yyyymmdd"), where yyyymmdd = today. if there isn't one for today, I'd like it to backup the database. I feel the need to backup my back end daily on the simple fact that I'm running on generator power in austere conditions, and the back end resides on an external hard drive... (just a lil' added info).... <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Search to see if file exists (A2K)

    You can test like this:

    If Dir("XXX.XXX.XX.XXsharedatabasenew_folderBackup" & Format(Date, "yyyymmdd")) = "" Then
    ' file does not exist, so create backup
    ...
    End If

    If you do a search in this forum for schedule backup, you'll find several threads dealing with creating scheduled backups of a database.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Search to see if file exists (A2K)

    Works great! I'm not actually putting it to use yet, I just wanted to know *how* to do it. Where do you learn about "things" like Dir, etc...? (My Access 2000 Bible hasn't said anything about it yet, and it's not in the index, I doubt I will find it used at all, as the VBA section is quite short....I've ordered Beginning Access 2000 VBA by Robert Smith, I figure any added info is better than asking countless questions on here


    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17>If you take my number of posts, divide it by 5 (would be 3, the average number of posts/replies necessary to figure out my simple problems, but to account for my senseless posts in Scuttlebutt), that should actually put a number pretty close to "countless" questions.... <img src=/S/nuts.gif border=0 alt=nuts width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Search to see if file exists (A2K)

    Dir is a general VB/VBA function, it is not specific to Access. If you type Dir somewhere in the Visual Basic Editor (e.g. in the Immediate window) and press F1, you'll get help. It's useful to click See Also in the help window (if available) to learn about related instructions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •