DoCmd.RunSQL "CREATE TABLE [" & strExcelTableName & "] ([" & strColumnName &
"] Memo);"
Or, better yet, don't allow spaces in the names.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Del" <(E-Mail Removed)> wrote in message
news:4E982758-0967-49E6-8873-(E-Mail Removed)...
>I am creating a table in Access 2000 to import data from an Excel
> spreadsheet. It is necessary to name the table and its fields exactly the
> same as the spreadsheet and its header name for the column. This code
> works
> fine if there are no spaces in the header name.
>
> DoCmd.RunSQL "CREATE TABLE " & strExcelTableName & " (" & strColumnName &
> "
> Memo);"
>
> But when the header name has a space it generates a syntax error in the
> field definition. What code do I need to deal with these spaces?
> --
> Thank you,
> Del