Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rating: Thread Rating: 10 votes, 5.00 average. Display Modes
Old 05-19-2008, 06:55 PM   #1
dibangdit
Registered User
 
Join Date: May 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
dibangdit is on a distinguished road
[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.

dibangdit is offline   Reply With Quote
Old 05-19-2008, 11:35 PM   #2
ErikSnoek
Programmer
 
ErikSnoek's Avatar
 
Join Date: Apr 2007
Location: The Netherlands
Posts: 100
Thanks: 0
Thanked 1 Time in 1 Post
ErikSnoek is on a distinguished road
Autonumber = counter
Memo = memo

e.g.:
"CREATE TABLE exTable (ID counter, Name memo)"
Creates a table with an autonumber field named "ID" and a memo field called "Name".
ErikSnoek is offline   Reply With Quote
Old 05-21-2008, 08:32 PM   #3
dibangdit
Registered User
 
Join Date: May 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
dibangdit is on a distinguished road
Thank you, ErikSnoek.

dibangdit is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to generate create table statments using vba tony007 Modules & VBA 2 12-03-2008 05:02 AM
How do I create a table that contains figures calculated from other tables? Riz-Man Tables 3 02-18-2008 07:23 AM
create a progress bar in VB JohnLee Modules & VBA 3 01-08-2008 07:29 AM
Populate table using vba treva26 Modules & VBA 9 10-15-2007 08:00 PM
Create Table with VBA mtahir Modules & VBA 2 09-10-2006 11:01 AM




All times are GMT -8. The time now is 12:19 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World