Results 1 to 16 of 16

Thread: Temporary Table

Hybrid View

  1. #1
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: Temporary Table

    I believe that this code will give you a list of tables in an Access database. I haven't been able to test it though.

    Code:
    SELECT Name FROM MSysObjects
    WHERE Type=1 AND Flags=0
    Dropping tables is simple:
    Code:
    DROP TABLE t_test
    I got all the above information from here
    This world is not my home. I'm just passing through.

  2. #2
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    Re: Temporary Table

    What rally springs to mind is this:

    Why do you need a table instead of a Query?

    But you want an anwer instead of a question I suppose.....

    Code:
    Sub AddTable()
    
    Dim db As DAO.Database
    Dim tbl As DAO.TableDef
    
    ' you should look at the optional arguments too
    
    Set db = DAO.OpenDatabase("Yourdatabase")
    
    Set tbl = db.CreateTableDef("Test2")
    
    tbl.Fields.Append tbl.CreateField("Id", dbLong)
    tbl.Fields.Append tbl.CreateField("Name", dbText, 50)
    tbl.Fields.Append tbl.CreateField("Stmp", dbDate)
    
    db.TableDefs.Append tbl
    
    Set tbl = Nothing
    db.Close
    Set db = Nothing
    
    End Sub
    will make a table the SQL DROP table as suggested will delete it
    you could also use the SQL CREATE TABLE to build one but in Access DAO should work fine
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

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