Results 1 to 3 of 3

Thread: [Access 2007] How do i create table in VBA

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2008
    Posts
    2

    [Access 2007] How do i create table in VBA

    Hello.
    I want to create a table from VBA code like this example:

    Sub CREATE_TABLE()
    Dim MySQL As String

    MySQL = "CREATE TABLE exTable (ID integer, Name text (50))"
    DoCmd.SetWarnings False
    DoCmd.RunSQL MySQL
    DoCmd.SetWarnings True
    End Sub

    My problem is i don't know which datatype i should use to create a memo field or how to create an autonumber field.

    How many way to create a table automatically through VBA?

    Thanks for you answers and please excuse my english.
    Last edited by dibangdit; May 19th, 2008 at 09:49 PM.

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: [Access 2007] How do i create table in VBA

    Easiest is manually
    Then via sql (although types can be a pain...)
    Next through vba, using the DAO and the tabledefs.
    Next is ADO using ADOX schema

    There is a lot of help on how to do this on msdn.

    Have a play and post back your code when you have a question/problem.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2008
    Posts
    2

    Re: [Access 2007] How do i create table in VBA

    Thank you, Ecniv.

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