A Procedure Which Looks Inside of an Entire Windows Folder, for a - Microsoft Community


in post today, entitled "about findrecord.mdb"
hansv mvp replied on  july 23, 2017

, helpful.

i'm seeking procedure looks inside of entire windows folder, tablename or data inside record.
  possible?

here macro find databases contain table name specified user in folder specified user.

the names displayed in message box , in immediate window.

sub findtable()
    dim strtable string
    dim strfolder string
    dim strfile string
    dim strlist string
    dim dbs dao.database
    dim tdf dao.tabledef
    strtable = inputbox("enter name of table you're looking for")
    if strtable = "" then
        beep
        exit sub
    end if
    application.filedialog(4) ' msofiledialogfolderpicker
        if .show then
            strfolder = .selecteditems(1) & "\"
        else
            beep
            exit sub
        end if
    end with
    strfile = dir(strfolder & "*.accdb") ' or use *.mdb
    while strfile <> ""
        set dbs = dbengine.opendatabase(strfolder & strfile)
        set tdf = nothing
        on error resume next
        set tdf = dbs.tabledefs(strtable)
        on error goto 0
        if not tdf nothing then
            strlist = strlist & vbcrlf & strfile
            debug.print strfile
        end if
        dbs.close
        strfile = dir
    loop
    if strlist = "" then
        msgbox "table not found in database in folder!", vbinformation
    else
        msgbox "table found in:" & strlist, vbinformation
    end if
end sub



Office / Access / Windows other



Comments

Popular posts from this blog

Getting ErrorCode: 120018 when trying to access Microsoft account - Microsoft Community

The message was sent to a distribution list ‎(DL)‎ - Microsoft Community

Activation Error 0x8004FE93 - Microsoft Community