Full Version: CREATE TABLE
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
BartHughes
I am making a copy of one of my tables. The following code produces a syntax error. Can someone enlighten me? frown.gif

Thanks,
Bart

CREATE TABLE Inputs_StationaryInputs SELECT * FROM Inputs_LinkedInputs;
R. Hicks
Hmmmm ....

Try:
CODE
SELECT Inputs_LinkedInputs.* INTO Inputs_StationaryInputs
FROM Inputs_LinkedInputs;

RDH
BartHughes
That's the route I was down earlier, but I get the error message "Invalid Operation".
R. Hicks
I have tested this and I works on my machine ...
It's just a simple Make Table Query ... and should work.

Is the table you are referencing in the current database ???

Post exactly what is returning the error you described ...

RDH
BartHughes
No, I am creating it. I see now that the problem lies in the syntax of my DAO code. I ran your SQL in the query window and it worked fine. However, I am wanting to do the operation with VBA. The following code produces the error:

Dim MyDB As DAO.Database
Dim MyRecSet As DAO.Recordset
Dim SQLString As String

SQLString = "SELECT Inputs_LinkedInputs.* INTO Inputs_StationaryInputs FROM Inputs_LinkedInputs;"
Set MyDB = CurrentDb
Set MyRecSet = MyDB.OpenRecordset(SQLString)
R. Hicks
This should be all you need ....
CODE
Dim strSQL As String



strSQL = "SELECT Inputs_LinkedInputs.* " & _

"INTO Inputs_StationaryInputs " & _

"FROM Inputs_LinkedInputs;"

  

CurrentDb.Execute strSQL, dbFailOnError

RDH
BartHughes
that's the ticket. Thanks!

Bart

I think you had responded to another question I had that was double posted on the wrong group (my first post :(... ) . I received an email saying I had a response but the thread was deleted becuase of my double post. The link is below to the other question. Can you give me some pointers to go look up some info on? Is it just a recursive loop that adds locates the children and adds them?


http://www.utteraccess.com/forums/showflat...;o=&fpart=1
R. Hicks
You are very Welcome ... frown.gif

Just looked at the other post ... I haven't a clue ...

RDH

Edited by: R. Hicks on 08.14.04.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.