Simple SQL Statement

threni

New member
Local time
Today, 13:01
Joined
Aug 18, 2010
Messages
5
Trying to write an SQL string for creating a table with two fields.
One field goes fine:

SQL = "CREATE TABLE x" & _
" (f CHAR(5))":D

DoCmd.RunSQL SQL

But
SQL = "CREATE TABLE x" & _
" (f CHAR(5)), (g CHAR(5))":confused:

doesnt. Please tell me what I am missing.

I am not including the emoticons in the code, btw.
 
Try this:

SQL = "CREATE TABLE x" & _
" (f CHAR(5), g CHAR(5))"
 
Thanks, but I still get an "error in field statement" message for that. Here is the actual code:

SQL = "CREATE TABLE [" & strStudent & "]" & _
"(Piece CHAR(20), Date CHAR(10))"
DoCmd.RunSQL SQL:(

It works with one field specified, thus:

SQL = "CREATE TABLE [" & strStudent & "]" & _
" (Piece CHAR(20))":D

Would appreciate any ideas- this sort of clerical fussing about prevents one from actually doing any interesting programming.
 
Date is generally a reserved word, call your Date field something else.
 
Thanks again, that was the problem. Pretty dumb of me, and clever of you.:)
 

Users who are viewing this thread

Back
Top Bottom