Results 1 to 3 of 3

Thread: creating an access table in a db

  1. #1

    Thread Starter
    Addicted Member trasher's Avatar
    Join Date
    Jun 2001
    Location
    Quebec city, Qc, Canada
    Posts
    255

    creating an access table in a db

    hi,

    I just want to create a table in an existing access db in vb.
    Someone could help me ? I just can't figure out how.

    here's some code

    Code:
    Private Sub cmdSaveBD_Click()
        
        Dim accessApp As Object
    
        
        dlg.Filter = "Microsoft Access database (*.mdb)|*.mdb"
        dlg.Flags = cdlOFNOverwritePrompt
        dlg.CancelError = True
        dlg.ShowSave
        
        If Err.Number = cdlCancel Then
            'User selected cancel
                Exit Sub
        End If
        
        bdPath = dlg.FileName
        
        Set accessApp = CreateObject("Access.Application")
        
        accessApp.NewCurrentDatabase bdPath
        'Here I want to create my table
        '....
        accessApp.Quit acQuitSaveAll
    End Sub
    Heads will roll...

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    accessApp.CreateTableDef "NewTable1"

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Addicted Member trasher's Avatar
    Join Date
    Jun 2001
    Location
    Quebec city, Qc, Canada
    Posts
    255
    Ok I found how.....
    I just forgot to append my tabledef to the tableDefs collection....

    bd.TableDefs.Append myTable

    .... I should read more the help files content.... heh

    thanks
    Heads will roll...

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