Another SQL

IanT

Registered User.
Local time
Today, 15:12
Joined
Nov 30, 2001
Messages
191
Hi

Have got this code but cannot get it to work. Has anyone have any idea why! It cannot find the input table dbCentralFulfillment!

Dim dbs As Database
Set dbs = OpenDatabase("C:\Documents and Settings\ithompson\Desktop\XeroxCentralDataBase.mdb")

dbs.Execute ("INSERT INTO tblFulfillment " _
& "SELECT * " _
& "FROM dbCentralFulfillment")
dbs.Close
 
IanT said:
Has anyone have any idea why!

You are trying to select from a database - DQL only selects from tables and queries.
 
Ideas please

Mile-O-Phile said:
You are trying to select from a database - DQL only selects from tables and queries.
Does anyone have any ideas on how I can append the data from a quey to a table in another data base! The key here is I want the data to be added to the existing!
 
A few things for you to try:

  • Open up the query designer;
  • Change your query to an Append Query;
  • Follow the rest of the onscreen instructions;

You don't need all this code rubbish to do a simple query like that. :)
 
Code rubbish ... hmph

Try this:

INSERT INTO tblFulfillment IN 'C:\Documents and Settings\ithompson\Desktop\XeroxCentralDataBase.mdb'
SELECT *
FROM dbCentralFulfillment

assuming that you are in the DB that contains dbCentralFulfillment and the table stucture is exactly the the same for the tblFulfillment. I am a person who likes to enumerate all of the fields, so I would use:

INSERT INTO tblFulfillment (TheFirstField, TheNextField ...) IN 'C:\Documents and Settings\ithompson\Desktop\XeroxCentralDataBase.mdb'
SELECT ThisField, ThatField ...
FROM dbCentralFulfillment

That way, if you have them in a different order or the field names are different, you are fine.
 

Users who are viewing this thread

Back
Top Bottom