SQL Syntax Creating a Table

bnw

Registered User.
Local time
Today, 03:05
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.
 
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

Back
Top Bottom