Update Query Syntax

G

Guest

Hello,

I'd like some help on the SQL Syntax or preferably, the method to use the
QBE window to do the following:

1. Use a query to select/sum data to then update data in another table.

The syntax of the SQL statement of what I have thus far is listed below.

I am trying to join on Loan Number and Quarter Ending Date.
I am trying to update Coll_Value1 with Coll_Total.

UPDATE tbl_LLMasterData_Collat_Lien SET
tbl_LLMasterData_Collat_Lien.Coll_Value1 =
[qry_LLCrossCollat_SumByLoan2]![CollTotal]
WHERE (((tbl_LLMasterData_Collat_Lien.Loan_Number) In (Select
X_Collateral_Master_LoanNumber From qry_LLCrossCollat_SumByLoan2)) AND
((tbl_LLMasterData_Collat_Lien.QuarterEndingDate) In (Select
QuarterEndingDate From qry_LLCrossCollat_SumByLoan2)));

Thanks.
 
G

George Nicholson

UPDATE tbl_LLMasterData_Collat_Lien
INNER JOIN tbl_LLMasterData_Collat_Lien
ON qry_LLCrossCollat_SumByLoan2.X_Collateral_Master_LoanNumber =
tbl_LLMasterData_Collat_Lien.Loan_Number AND
qry_LLCrossCollat_SumByLoan2.QuarterEndingDate =
tbl_LLMasterData_Collat_Lien.QuarterEndingDate
SET tbl_LLMasterData_Collat_Lien.Coll_Value1 =
[qry_LLCrossCollat_SumByLoan2]![CollTotal]

HTH
 
G

Guest

George,

Thanks for the reply.

However, I get an error: "Syntax Error in JOIN Operation", and the following
is highlighted "qry_LLCrossCollat_SumByLoan2" on the line "ON
qry_LLCrossCollat_SumByLoan2.X_Collateral_Master_LoanNumber =
tbl_LLMasterData_Collat_Lien.Loan_Number AND "

Any ideas?
--
David


George Nicholson said:
UPDATE tbl_LLMasterData_Collat_Lien
INNER JOIN tbl_LLMasterData_Collat_Lien
ON qry_LLCrossCollat_SumByLoan2.X_Collateral_Master_LoanNumber =
tbl_LLMasterData_Collat_Lien.Loan_Number AND
qry_LLCrossCollat_SumByLoan2.QuarterEndingDate =
tbl_LLMasterData_Collat_Lien.QuarterEndingDate
SET tbl_LLMasterData_Collat_Lien.Coll_Value1 =
[qry_LLCrossCollat_SumByLoan2]![CollTotal]

HTH


David said:
Hello,

I'd like some help on the SQL Syntax or preferably, the method to use the
QBE window to do the following:

1. Use a query to select/sum data to then update data in another table.

The syntax of the SQL statement of what I have thus far is listed below.

I am trying to join on Loan Number and Quarter Ending Date.
I am trying to update Coll_Value1 with Coll_Total.

UPDATE tbl_LLMasterData_Collat_Lien SET
tbl_LLMasterData_Collat_Lien.Coll_Value1 =
[qry_LLCrossCollat_SumByLoan2]![CollTotal]
WHERE (((tbl_LLMasterData_Collat_Lien.Loan_Number) In (Select
X_Collateral_Master_LoanNumber From qry_LLCrossCollat_SumByLoan2)) AND
((tbl_LLMasterData_Collat_Lien.QuarterEndingDate) In (Select
QuarterEndingDate From qry_LLCrossCollat_SumByLoan2)));

Thanks.
 
G

Guest

Got the syntax working (see snippet below-I believe the parens where
needed?).

Now get the message when running: "Operation must use an updateable query".

Ideas?

UPDATE tbl_LLMasterData_Collat_Lien INNER JOIN qry_LLCrossCollat_SumByLoan1
ON (tbl_LLMasterData_Collat_Lien.QuarterEndingDate =
qry_LLCrossCollat_SumByLoan1.QuarterEndingDate) AND
(tbl_LLMasterData_Collat_Lien.Loan_Number =
qry_LLCrossCollat_SumByLoan1.X_Collateral_Master_LoanNumber) SET
tbl_LLMasterData_Collat_Lien.Coll_Value1 =
qry_LLCrossCollat_SumByLoan1!SumOfColl_Value1;
--
David


George Nicholson said:
UPDATE tbl_LLMasterData_Collat_Lien
INNER JOIN tbl_LLMasterData_Collat_Lien
ON qry_LLCrossCollat_SumByLoan2.X_Collateral_Master_LoanNumber =
tbl_LLMasterData_Collat_Lien.Loan_Number AND
qry_LLCrossCollat_SumByLoan2.QuarterEndingDate =
tbl_LLMasterData_Collat_Lien.QuarterEndingDate
SET tbl_LLMasterData_Collat_Lien.Coll_Value1 =
[qry_LLCrossCollat_SumByLoan2]![CollTotal]

HTH


David said:
Hello,

I'd like some help on the SQL Syntax or preferably, the method to use the
QBE window to do the following:

1. Use a query to select/sum data to then update data in another table.

The syntax of the SQL statement of what I have thus far is listed below.

I am trying to join on Loan Number and Quarter Ending Date.
I am trying to update Coll_Value1 with Coll_Total.

UPDATE tbl_LLMasterData_Collat_Lien SET
tbl_LLMasterData_Collat_Lien.Coll_Value1 =
[qry_LLCrossCollat_SumByLoan2]![CollTotal]
WHERE (((tbl_LLMasterData_Collat_Lien.Loan_Number) In (Select
X_Collateral_Master_LoanNumber From qry_LLCrossCollat_SumByLoan2)) AND
((tbl_LLMasterData_Collat_Lien.QuarterEndingDate) In (Select
QuarterEndingDate From qry_LLCrossCollat_SumByLoan2)));

Thanks.
 
J

Jamie Collins

Now get the message when running: "Operation must use an updateable query".

Ideas?

UPDATE tbl_LLMasterData_Collat_Lien INNER JOIN qry_LLCrossCollat_SumByLoan1
ON (tbl_LLMasterData_Collat_Lien.QuarterEndingDate =
qry_LLCrossCollat_SumByLoan1.QuarterEndingDate) AND
(tbl_LLMasterData_Collat_Lien.Loan_Number =
qry_LLCrossCollat_SumByLoan1.X_Collateral_Master_LoanNumber) SET
tbl_LLMasterData_Collat_Lien.Coll_Value1 =
qry_LLCrossCollat_SumByLoan1!SumOfColl_Value1;

Based on your column names, I'm thinking this might be the problem:

ACC: Update Query Based on Totals Query Fails
http://support.microsoft.com/kb/116142

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top