Results 1 to 3 of 3

Thread: create tables in MS Access through VB6

  1. #1
    Join Date
    Jun 2006
    Posts
    47

    create tables in MS Access through VB6

    Using VB6 and MS Access 2003. I would like to create a simple table in the database. I'm able to do this fine... but here's the catch. I want to create an AutoNumbering Index in my table as a Primary Key. How do I do
    that? I can make it a Primary Key, but can't seem to set the datatype as autonumbering.

    Second. How do I create a field that is a Lookup table query? Can this be accomplished via VB6?

    My current DB interactions are ADO... but could use DAO if that is better...

    I have had little to no luck in my searches on the Internet.

    Thanks

  2. #2
    Join Date
    Jun 2006
    Posts
    623
    either run create table queries or else TableDefs.Add

    if you're new to this then try it out from within an access module to see how it works, then you can add a reference to DAO in vb and copy in your code.

    Also this: VB code for creating access

    Private Sub Form_Load()
    Const strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\n13437\My Documents\db1.mdb;Persist Security Info=False"

    Dim cnn As New ADODB.connection
    Dim cmd As New ADODB.Command

    cnn.ConnectionString = strConnection
    cnn.Open

    cmd.ActiveConnection = cnn
    cmd.CommandText = "create table tnn1 (a varchar(10), b number)"

    cmd.Execute
    cnn.Close

    End Sub

  3. #3
    Join Date
    Dec 2007
    Posts
    1,599

Similar Threads

  1. How To Create Tables in Flash
    By sweetsriheart in forum Software Development
    Replies: 1
    Last Post: 03-09-2010, 05:18 PM
  2. How to create MySQL Database and Tables in PHP?
    By Orton in forum Software Development
    Replies: 4
    Last Post: 23-02-2010, 06:45 AM
  3. Replies: 7
    Last Post: 27-11-2009, 12:31 AM
  4. Sample database script to create tables
    By Naresh Modi in forum Software Development
    Replies: 3
    Last Post: 12-08-2009, 02:17 PM
  5. How to create Tables in HTML ?
    By Sudra in forum Software Development
    Replies: 2
    Last Post: 21-02-2009, 09:01 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,254,432.75737 seconds with 17 queries