Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 11-10-2008
Member
 
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
Reply With Quote
  #2  
Old 11-10-2008
Member
 
Join Date: Jun 2006
Posts: 620
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
Reply With Quote
  #3  
Old 11-10-2008
Member
 
Join Date: Dec 2007
Posts: 1,592
see this link

http://support.microsoft.com/kb/108147
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "create tables in MS Access through VB6"
Thread Thread Starter Forum Replies Last Post
How To Create Tables in Flash sweetsriheart Software Development 1 03-09-2010 05:18 PM
How to create MySQL Database and Tables in PHP? Orton Software Development 4 23-02-2010 06:45 AM
How to create table and Modify tables in Microsoft Access 2007 Antonio1 Windows Software 7 27-11-2009 12:31 AM
Sample database script to create tables Naresh Modi Software Development 3 12-08-2009 02:17 PM
How to create Tables in HTML ? Sudra Software Development 2 21-02-2009 09:01 AM


All times are GMT +5.5. The time now is 11:07 PM.