Results 1 to 2 of 2
  1. #1
    geoffishere is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    10

    Checking if files exists

    I was wondering if this was possible. I have a list of names in a column. There are matching named files in a folder. In excel i used to run a macro to check if these files exist. Is it possilble to do this in access. The code i used in excel is below



    Sub check()

    Dim LRow As Integer
    Dim LPath As String
    Dim LExtension As String
    Dim LContinue As Boolean

    'Initialize variables
    LContinue = True
    LRow = 2
    LPath = "K:\School of Community, Health Sciences and Social Care\Central school\ADMIN STAFF FOLDERS\Matthew Holden\Excel\"
    LExtension = ".xls"

    'Loop through all column A values until a blank cell is found
    While LContinue

    'Found a blank cell, do not continue
    If Len(Range("A" & CStr(LRow)).Value) = 0 Then
    LContinue = False

    'Check if file exists for part number
    Else
    'Place "No" in column B if the file does NOT exist
    If Len(Dir(LPath & Range("A" & CStr(LRow)).Value & LExtension)) = 0 Then
    Range("B" & CStr(LRow)).Value = "No"
    'Place "Yes" in column B if the file does exist
    Else
    Range("B" & CStr(LRow)).Value = "Yes"
    End If
    End If

    LRow = LRow + 1

    Wend

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    the Dir() function works the same way in Access.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to use if not exists in access?
    By halifaxdalRaymondXie in forum Queries
    Replies: 1
    Last Post: 01-14-2010, 03:18 PM
  2. Checking List Box Value with Combo box selection
    By empyrean in forum Programming
    Replies: 1
    Last Post: 10-23-2009, 06:01 PM
  3. Checking for Value in Query
    By jgelpi in forum Access
    Replies: 1
    Last Post: 06-24-2009, 04:57 PM
  4. Checking a record in a table
    By widstje in forum Programming
    Replies: 4
    Last Post: 11-07-2007, 11:28 AM
  5. Need help checking database design
    By abc7 in forum Database Design
    Replies: 1
    Last Post: 10-29-2007, 08:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums