SQL Syntax Creating a Table (1 Viewer)

bnw

Registered User.
Local time
Today, 14:16
Joined
Sep 19, 2006
Messages
26
Hello

I would like to know what is the syntax I can use to create a table field with a decimal point datatype and a field with a memo datatype? Lastly, a field with byte datatype?

Thank you in advance for your speedy response.
 

Vonnie

Registered User.
Local time
Today, 14:16
Joined
Aug 21, 2008
Messages
57
This kind of coding is everywhere Search for 'CreateTable'

Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
Dim strSQL As String

For Each obj In dbs.AllTables
If obj.Name = "tblTemp" Then
' table already exists so do something to avoid an error
DoCmd.DeleteObject acTable, obj.Name
End If

Next obj

strSQL = "CREATE TABLE tblTemp(DecimalVal CURRENCY, Info MEMO, Question BYTE, ValidDate DATETIME)"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
 

Users who are viewing this thread

Top Bottom