Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Into - error 3073

Status
Not open for further replies.

JDRoss

MIS
Sep 27, 2002
67
0
0
IE
Dear Tek Tips

I am getting error 3073 (operations must use an updateable query) when I run this code to insert into a table from another table.

Code:
strsql = "Insert into tblchngecustomers Select * From customers WHERE customersID In (" & Criteria & ")"
  
db.Execute strsql

Criteria is a selection from a multilist select. It contains customer id numbers.
Code:
Set ctl = Me![CustomerList]
    For Each Itm In ctl.ItemsSelected
        If Len(Criteria) = 0 Then
            Criteria = ctl.ItemData(Itm)      
        Else
            Criteria = Criteria & "," & ctl.ItemData(Itm)                                
        End If
    Next Itm

Could this be a problem that I am addressing these numbers as text instead of numbers?

Appreciate your help

Regards

John


 
If possible, could you place a STOP as shown below, execute the code, and when it hits the stop, go to the immediate window, type ?strsql, and then paste the result back to the forum?

Also, what is the field type of CustomersID ?

strsql = "Insert into tblchngecustomers Select * From customers WHERE customersID In (" & Criteria & ")"

STOP

db.Execute strsql
 

vbajock

Thanks for your response. The result of Stopping the code and interrogating strsql is as below.

Code:
?strsql
Insert into tblchngecustomers Select * From customers WHERE CustomersID In (2422)

CustomersId is type number (long integer)

Regards

John
 
here's yours:
Insert into tblchngecustomers Select * From customers WHERE CustomersID In (2422)

This works for me:
INSERT INTO table2
SELECT Table1.*
FROM Table1
WHERE (((Table1.CustomerID) In (1212,1234,12345,123456)));

The big difference, other than the parentheses, seems to be Table1.CustomerID in my Where clause and select clause. Try that.






 
Thanks vbajock

This works fine for me too when I preview it in a query in design view. But when I go to run the query I still get the error 3073 the same as when I run it in the code.
Code:
Insert into tblchngeCustomers Select Customers.* From Customers WHERE Customers.customersID In (2224)

Could the following be the issue? I am running this append query to a backend database. I have checked the permissions and they are ok.

Other than that, everything seems to work fine in a syntax way up till the execute statement.

Any ideas?

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top