A Procedure Which Looks Inside of an Entire Windows Folder, for a - Microsoft Community
- Get link
- X
- Other Apps
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
- Get link
- X
- Other Apps
Comments
Post a Comment