|
-
April 5th, 2001, 08:48 AM
#1
SQL syntax
I am getting a syntax error in the FROM clause error and for the life of me I cannot see what is wrong with my SQL string. Here it is:
SQLStmt = "SELECT " & strTableName & ".* INTO [CLEARANCE] FROM " & strTableName
strTableName is the name of a table that I extracted from TableDef earlier in the module. Am I blind? :-)
-
April 5th, 2001, 09:06 AM
#2
Re: SQL syntax
Try this
SQLStmt = "SELECT * INTO NewTable FROM " & strTableName
or if you need to insert into different table
SQLStmt = "INSERT INTO NewTable SELECT * FROM " & strTableName
Iouri Boutchkine
[email protected]
-
April 5th, 2001, 09:37 AM
#3
Re: SQL syntax
No, not quite what I was looking for. I just happened to stumble upon the solution just a couple minutes ago. I had forgotten to mention that the table name represented by strTableName has two forward slashes in it. I thought there was no problem with that because in an earlier procedure I was using the reverse process and putting the table name (that contains slashes) in an INTO clause and VB did not complain one bit, but for some quirky reason it does complain when those same table names are in the FROM clause. So what I had to do is surround my table name variable with backquotes (NOT single quotes, but the quote found on the tilde (˜) key) like this:
SQLStmt = "SELECT " & strTableName & ".* INTO [CLEARANCE] FROM `" & strTableName & "`"
dbClearance.Execute (SQLStmt)
-
April 5th, 2001, 03:17 PM
#4
Re: SQL syntax
this sounds like an "INSERT" statment
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|