CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Files (Urgent)

  1. #1
    Guest

    Files (Urgent)

    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



  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Files (Urgent)

    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.



  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Files (Urgent)

    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
    [email protected]
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  4. #4
    Guest

    Re: Files (Urgent)

    Wow!!! Thanks a mill. guys!!!! I'll try it out....


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured