crystalreporting
Instructor
Hi,
I've developed this SQL statement and it runs fine in MS/SQL Query Analyzer;
Update OEORDHDR_SQL set OEORDHDR_SQL.tot_sls_amt = (Select SUM(Round(OEORDLIN_SQL.qty_to_ship * OEORDLIN_SQL.unit_price * ( 100 - OEORDLIN_SQL.discount_pct ) / 100,2 )) from OEORDLIN_SQL where OEORDHDR_SQL.ord_type = OEORDLIN_SQL.ord_type AND OEORDHDR_SQL.ord_no = OEORDLIN_SQL.ord_no AND OEORDHDR_SQL.selection_cd = 'S')
I'm now wanting this to run within an MSAccess application as part of a click event so I created this code;
'Recalculate the total sales amount based on the orders selected and the qty to ship
sql_statement = "Update db
EORDHDR_SQL set db
EORDHDR_SQL.tot_sls_amt =" & _
"(Select SUM(Round(db
EORDLIN_SQL.qty_to_ship * db
EORDLIN_SQL.unit_price * ( 100 - db
EORDLIN_SQL.discount_pct ) / 100,2 )) " & _
"from db
EORDLIN_SQL where db
EORDHDR_SQL.ord_type = db
EORDLIN_SQL.ord_type AND " & _
"db
EORDHDR_SQL.ord_no = db
EORDLIN_SQL.ord_no AND db
EORDHDR_SQL.selection_cd = 'S')"
DoCmd.RunSQL (sql_statement)
I get a message that tells me the operation must use an updateable query. So I tried to do this as two separate queries (a select followed by an update) but I still get the same message.
Any ideas?
Peter Shirley
Macola Consultant, PA and surrounding states.
I've developed this SQL statement and it runs fine in MS/SQL Query Analyzer;
Update OEORDHDR_SQL set OEORDHDR_SQL.tot_sls_amt = (Select SUM(Round(OEORDLIN_SQL.qty_to_ship * OEORDLIN_SQL.unit_price * ( 100 - OEORDLIN_SQL.discount_pct ) / 100,2 )) from OEORDLIN_SQL where OEORDHDR_SQL.ord_type = OEORDLIN_SQL.ord_type AND OEORDHDR_SQL.ord_no = OEORDLIN_SQL.ord_no AND OEORDHDR_SQL.selection_cd = 'S')
I'm now wanting this to run within an MSAccess application as part of a click event so I created this code;
'Recalculate the total sales amount based on the orders selected and the qty to ship
sql_statement = "Update db
"(Select SUM(Round(db
"from db
"db
DoCmd.RunSQL (sql_statement)
I get a message that tells me the operation must use an updateable query. So I tried to do this as two separate queries (a select followed by an update) but I still get the same message.
Any ideas?
Peter Shirley
Macola Consultant, PA and surrounding states.