Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 make table query

Author  Topic 

dpwhitedp
Starting Member

5 Posts

Posted - 2004-05-05 : 17:26:53
Dim table1 as string
Dim db1 As Database
Set db1 = CurrentDb
table1 = "newtable"
select1="select field1 into table1 from oldtable"
db1.execute "select1"

works find except that it puts it into a table called table1.
I want it to go into a table called "newtable"

Help is appreciated

annac
Starting Member

8 Posts

Posted - 2004-05-05 : 17:40:43
I'm guessing, but in your select string, table1 is within the quotes, and therefore won't be recognised as a variable. I would have thought you would need to close quotes, concatenate the variable and then reopen quotes to finish the statement.

-------------------------------------------------------------
If at first you don't succeed destroy all evidence that you tried.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-05 : 18:25:51
Yes that is true.

select1="select field1 into " & table1 & " from oldtable"


Tara
Go to Top of Page
   

- Advertisement -