Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    1

    Unanswered: Creating a new table.......

    Hi there,
    I am a new access suer and was wondering if you may be able to help me.
    I want to create a new table but to use an existing table as the structure.
    Basically i have a very large table (10,000s of rows) and have set up some VB to display some statistics of the table, ie averages, certain frequency counts etc, I have this also working when a user sets certain boundaries so only certain records of the table are used in the statistical analysis. I would like the user to have the choice of creating a new table which contains all the records of the large table which fits their critieria (i.e COLOUMA value must be between x and y for example). Now the filtering is in place but currently to define the table I am using

    Dim tbl As TableDef
    Dim fld as field

    set fld = tbl.createfield ("COL NAME", TYPE)

    This works fine but i need to create a table of the same structure as the main table, is there an easier way of doing this than defining each field in turn as this can take some time and would need to be altered if the sturture of my main table is altered.

    Thnaks for your time
    Rakesh

  2. #2
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Creating a new table.......

    Originally posted by gar74r73
    Hi there,
    I am a new access suer and was wondering if you may be able to help me.
    I want to create a new table but to use an existing table as the structure.
    Basically i have a very large table (10,000s of rows) and have set up some VB to display some statistics of the table, ie averages, certain frequency counts etc, I have this also working when a user sets certain boundaries so only certain records of the table are used in the statistical analysis. I would like the user to have the choice of creating a new table which contains all the records of the large table which fits their critieria (i.e COLOUMA value must be between x and y for example). Now the filtering is in place but currently to define the table I am using

    Dim tbl As TableDef
    Dim fld as field

    set fld = tbl.createfield ("COL NAME", TYPE)

    This works fine but i need to create a table of the same structure as the main table, is there an easier way of doing this than defining each field in turn as this can take some time and would need to be altered if the sturture of my main table is altered.

    Thnaks for your time
    Rakesh
    Could this work for you?

    Dim strSQL as string
    strSQL = "Select tblOld.Field1, tblOld.Field2 Into tblNew From tblOld"
    CurrentDb.Execute strSQL

    You can add a where clause also to restrict the records.

    You would also have to delete the table before each subsequent creation.

    Gregg

Posting Permissions

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