Results 1 to 4 of 4

Thread: Create Table

  1. #1

    Thread Starter
    Hyperactive Member nagasrikanth's Avatar
    Join Date
    Nov 2004
    Location
    India,Hyderabad.
    Posts
    420

    Lightbulb Create Table

    Wasn't the fallowing code creates a phisically visible table...???

    VB Code:
    1. Set d = w.OpenDatabase("C:\Documents and Settings\Administrator\Desktop\db11.mdb")
    2. Set rst = d.OpenRecordset("query1")
    3.     rst.MoveFirst
    4.     While Not rst.EOF
    5.         Set t = d.CreateTableDef(rst(0))
    6.         With t
    7.             .Fields.Append .CreateField("srikanth", dbText)
    8.         End With
    9.         rst.MoveNext
    10.         Set t = Nothing
    11.     Wend

    then y iam uanble to see how is my tables looks like...the code was running with out any error....please help in this issue.....its a bit urgent..pleasee..
    The Difference between a Successful person and others is not a Lack of Knowledge,
    But rather a Lack of WILL

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Create Table

    I think you need to append the TableDef to the database:
    VB Code:
    1. Set d = w.OpenDatabase("C:\Documents and Settings\Administrator\Desktop\db11.mdb")
    2. Set rst = d.OpenRecordset("query1")
    3.     rst.MoveFirst
    4.     While Not rst.EOF
    5.         Set t = d.CreateTableDef(rst(0))
    6.         With t
    7.             .Fields.Append .CreateField("srikanth", dbText)
    8.         End With
    9.         rst.MoveNext
    10.         [color=red]d.TableDefs.Append t[/color]
    11.         Set t = Nothing
    12.     Wend
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  3. #3

    Thread Starter
    Hyperactive Member nagasrikanth's Avatar
    Join Date
    Nov 2004
    Location
    India,Hyderabad.
    Posts
    420

    Re: Create Table

    yes...

    that is what the mistake i made...ny how...thanx for u r quick reply pnish
    The Difference between a Successful person and others is not a Lack of Knowledge,
    But rather a Lack of WILL

  4. #4
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Create Table

    nagasrikanth,

    For a good example look in my signature for Free VB Source Code and download the Import DBase IV files into an Access 2000 Database project.

    This will help you with creating a database along with tables and fields.

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