Inserting data from one table to Another Table

mallinarc

New member
Local time
Today, 14:51
Joined
Jul 1, 2003
Messages
8
Can anyone help me what is wrong with this code?

INSERT INTO tblMeterInformation ( Designation, PrimaryAmps )
SELECT [Meter Information].[Designation], [Meter Information].[PrimaryAmps]
FROM [Meter Information]
WHERE [Meter Information].[MeterNumber] = [tblMeterInformation].[MeterNumber];

I am new to Access, this kind of code works in Oracle but don't know why it is failing here.

Thanks for your Help.

Mallinarc
 
Does anything happen? Do you get an error message?
 
Last edited:
It is asking me to enter the "[tblMeterInformation].[MeterNumber]:" with a text box.


I was expecting it to read the table and match the values based on the tblMeterInformation and match with the Meter Number in Meter Information table then insert the value into tblMeterInformation table.


Thanks for attention

Mallinarc
 
OK, I see the problem here. Since tblMeterInformation is not a table in the query, Access is looking for it.

If you want Access to look within a table that is not among the tables in the query, you need to reference it via a subquery like this:
SELECT blah FROM blah WHERE blah IN (SELECT blah FROM blah);

Either join the tblMeterInformation table to your existing query or reference the table table in a subquery.
 

Users who are viewing this thread

Back
Top Bottom