Syntax problem (1 Viewer)

aziz rasul

Active member
Local time
Today, 04:54
Joined
Jun 26, 2000
Messages
1,935
I have the following code which works: -

For Index = 1 To LOPID_Count
strSQL = "CREATE TABLE [tblSFF - COSAR03] ([Record Type] TEXT (1));"
DoCmd.RunSQL strSQL
Next Index

This creates a table called "tblSFF - COSAR03" which is fine. However I now want to add the Index value at the end of the table name e.g. for Index = 1, the new table should be "tblSFF - COSAR031". I have tried the following code for strSQL i.e.

strSQL = "CREATE TABLE [tblSFF COSAR03] & Index & " ([Record Type] TEXT (1));"

However this doesn't work. Can anyone tell me how to change the syntax to obtain "tblSFF - COSAR031" etc?

[This message has been edited by aziz rasul (edited 06-11-2001).]

[This message has been edited by aziz rasul (edited 06-11-2001).]
 

axa

Registered User.
Local time
Today, 04:54
Joined
Mar 9, 2001
Messages
31
aziz,

its just a slight mis-positioning of the index value, try this instead:-

strSQL = "CREATE TABLE [tblSFF - COSAR03" & Index & "]([Record Type] TEXT (1));"

the result will then be what you want:

CREATE TABLE [tblSFF - COSAR031]([Record Type] TEXT(1));


Hope that helps,

axa
 

aziz rasul

Active member
Local time
Today, 04:54
Joined
Jun 26, 2000
Messages
1,935
I tried all sorts of strange combinations for strSQL but I never dreamed of that. That's great. Many Thanks axa.
 

Users who are viewing this thread

Top Bottom