Click to See Complete Forum and Search --> : Files (Urgent)


February 3rd, 2000, 09:38 AM
Does any body have any sample code to loop through a set of Access tables within a certain directory? I need to be able to loop through all the access tables in the given directory and make changes to certain fields within each table.
Thanks

Lothar Haensler
February 3rd, 2000, 09:44 AM
all access tables inside a database are stored withÃ*n a single MDB file.
Thus, after you open it using Opendatabase you can iterate over the tabledefs collection to access all tables in the database.

Cakkie
February 3rd, 2000, 10:09 AM
First, tables are in a database, databeses are in a dir.

If you got multiple tables in one database, use the tabledef to go through them, if you got more databases in one directory, use the dir command.



myDbFile = dir("path","*.mdb")

do while myDbFile <> ""

data1.databasename = myDbFile
data1.recordsource = "name_of_tabel"
data1.recordset.refresh

data1.recordset.movefirst

do while not(data1.recordset.eof)

with data1.recordset
.edit
.fields!field_to_modify = "new_value"
.update
.movenext
end with
loop

'check if there are anymore databases to process in the directory
myDbFile = dir

loop




Tom Cannaerts
slisse@planetinternet.be

February 3rd, 2000, 11:38 AM
Wow!!! Thanks a mill. guys!!!! I'll try it out....