![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have an update query which updates fields in two tables. The query is fired from an input form but when the command button is activated the query only changes the fields in one of the tables but fails to change a yes/no field in the second table. If I run the query again the yes/no field in the second table changes as anticipated. I would appreciate some help with this as it has me really confused! Steve What version? What is the SQL statement? |
#3
| |||
| |||
|
|
Steve_s wrote: I have an update query which updates fields in two tables. The query is fired from an input form but when the command button is activated the query only changes the fields in one of the tables but fails to change a yes/no field in the second table. If I run the query again the yes/no field in the second table changes as anticipated. I would appreciate some help with this as it has me really confused! Steve What version? *What is the SQL statement? It worked on a statement I ran that looked like this * * * * UPDATE CU INNER JOIN CH ON CU.UnitID = CH.UnitID * * * * SET CU.UnitNum = 40, CH.YN = False * * * * WHERE CU.PartsID=41; |
#4
| |||
| |||
|
|
On 17 July, 17:39, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Steve_s wrote: I have an update query which updates fields in two tables. The query is fired from an input form but when the command button is activated the query only changes the fields in one of the tables but fails to change a yes/no field in the second table. If I run the query again the yes/no field in the second table changes as anticipated. I would appreciate some help with this as it has me really confused! Steve What version? What is the SQL statement? It worked on a statement I ran that looked like this UPDATE CU INNER JOIN CH ON CU.UnitID = CH.UnitID SET CU.UnitNum = 40, CH.YN = False WHERE CU.PartsID=41; Access 2007 The SQL is: UPDATE qryMoveMachineSelect SET qryMoveMachineSelect.[AVAILABLE?] = No, qryMoveMachineSelect.ASSET_NUMBER = [Forms]![frmInstallations]! [Text43], qryMoveMachineSelect.OPENING_METER_1 = [Forms]! [frmInstallations]![txtMeter1], qryMoveMachineSelect.OPENING_METER_2 = [Forms]![frmInstallations]![txtmeter2], qryMoveMachineSelect.OPENING_METER_3 = [Forms]![frmInstallations]! [txtxMeter3], qryMoveMachineSelect.DATE_INSTALLED = [Forms]! [frmInstallations]![txtDate]; Originally I was trying to update directly to the tables but thought that may be the problem so I creaed a select query to get the data but the result was exactly the same |
#5
| |||
| |||
|
|
On 17 July, 17:39, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Steve_s wrote: I have an update query which updates fields in two tables. The query is fired from an input form but when the command button is activated the query only changes the fields in one of the tables but fails to change a yes/no field in the second table. If I run the query again the yes/no field in the second table changes as anticipated. I would appreciate some help with this as it has me really confused! Steve What version? *What is the SQL statement? It worked on a statement I ran that looked like this * * * * UPDATE CU INNER JOIN CH ON CU.UnitID = CH.UnitID * * * * SET CU.UnitNum = 40, CH.YN = False * * * * WHERE CU.PartsID=41; Access 2007 The SQL is: UPDATE qryMoveMachineSelect SET qryMoveMachineSelect.[AVAILABLE?] No, qryMoveMachineSelect.ASSET_NUMBER = [Forms]![frmInstallations]! [Text43], qryMoveMachineSelect.OPENING_METER_1 = [Forms]! [frmInstallations]![txtMeter1], qryMoveMachineSelect.OPENING_METER_2 [Forms]![frmInstallations]![txtmeter2], qryMoveMachineSelect.OPENING_METER_3 = [Forms]![frmInstallations]! [txtxMeter3], qryMoveMachineSelect.DATE_INSTALLED = [Forms]! [frmInstallations]![txtDate]; Originally I was trying to update directly to the tables but thought that may be the problem so I creaed a select query to get the data but the result was exactly the same Either you miscopied the SQL from your query or you have some messed |
#6
| |||
| |||
|
|
Steve_s <stev... (AT) hotmail (DOT) co.uk> wrote innews:9a2196e2-1381-45b3-a156-e7906a6f7d44 (AT) q12g2000yqj (DOT) googlegroups.co m: On 17 July, 17:39, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Steve_s wrote: I have an update query which updates fields in two tables. The query is fired from an input form but when the command button is activated the query only changes the fields in one of the tables but fails to change a yes/no field in the second table. If I run the query again the yes/no field in the second table changes as anticipated. I would appreciate some help with this as it has me really confused! Steve What version? *What is the SQL statement? It worked on a statement I ran that looked like this * * * * UPDATE CU INNER JOIN CH ON CU.UnitID = CH.UnitID * * * * SET CU.UnitNum = 40, CH.YN = False * * * * WHERE CU.PartsID=41; Access 2007 The SQL is: UPDATE qryMoveMachineSelect SET qryMoveMachineSelect.[AVAILABLE?] No, qryMoveMachineSelect.ASSET_NUMBER = [Forms]![frmInstallations]! [Text43], qryMoveMachineSelect.OPENING_METER_1 = [Forms]! [frmInstallations]![txtMeter1], qryMoveMachineSelect.OPENING_METER_2 [Forms]![frmInstallations]![txtmeter2], qryMoveMachineSelect.OPENING_METER_3 = [Forms]![frmInstallations]! [txtxMeter3], qryMoveMachineSelect.DATE_INSTALLED = [Forms]! [frmInstallations]![txtDate]; Originally I was trying to update directly to the tables but thought that may be the problem so I creaed a select query to get the data but the result was exactly the same Either you miscopied the SQL from your query or you have some messed up statements. When I break down the query into individual statements I see missing equals (=) *signs in 2 places) and missing quotes around a value. UPDATE qryMoveMachineSelect SET qryMoveMachineSelect.[AVAILABLE?] No, should be = 'no' or = false qryMoveMachineSelect.ASSET_NUMBER = [Forms]![frmInstallations]! [Text43], qryMoveMachineSelect.OPENING_METER_1 = [Forms]![frmInstallations]! [txtMeter1], qryMoveMachineSelect.OPENING_METER_2 [Forms]![frmInstallations]! [txtmeter2], missing equals sign qryMoveMachineSelect.OPENING_METER_3 = [Forms]![frmInstallations]! [txtxMeter3], qryMoveMachineSelect.DATE_INSTALLED = [Forms]![frmInstallations]! [txtDate];- Hide quoted text - - Show quoted text - |
#7
| |||
| |||
|
|
On 18 July, 16:22, Bob Quintal <rquin... (AT) sPAmpatico (DOT) ca> wrote: Steve_s <stev... (AT) hotmail (DOT) co.uk> wrote innews:9a2196e2-1381-45b3-a156-e790 6a6f7d44 (AT) q12g2000yqj (DOT) googlegroups.co m: On 17 July, 17:39, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Steve_s wrote: I have an update query which updates fields in two tables. The query is fired from an input form but when the command button is activated the query only changes the fields in one of the tables but fails to change a yes/no field in the second table. If I run the query again the yes/no field in the second table changes as anticipated. I would appreciate some help with this as it has me really confused! Steve What version? *What is the SQL statement? It worked on a statement I ran that looked like this * * * * UPDATE CU INNER JOIN CH ON CU.UnitID = CH.UnitID * * * * SET CU.UnitNum = 40, CH.YN = False * * * * WHERE CU.PartsID=41; Access 2007 The SQL is: UPDATE qryMoveMachineSelect SET qryMoveMachineSelect.[AVAILABLE?] No, qryMoveMachineSelect.ASSET_NUMBER [Forms]![frmInstallations]! [Text43], qryMoveMachineSelect.OPENING_METER_1 = [Forms]! [frmInstallations]![txtMeter1], qryMoveMachineSelect.OPENING_METER_2 [Forms]![frmInstallations]![txtmeter2], qryMoveMachineSelect.OPENING_METER_3 = [Forms]![frmInstallations]! [txtxMeter3], qryMoveMachineSelect.DATE_INSTALLED = [Forms]! [frmInstallations]![txtDate]; Originally I was trying to update directly to the tables but thought that may be the problem so I creaed a select query to get the data but the result was exactly the same Either you miscopied the SQL from your query or you have some messed up statements. When I break down the query into individual statements I see missing equals (=) *signs in 2 places) and missing quotes around a value. UPDATE qryMoveMachineSelect SET qryMoveMachineSelect.[AVAILABLE?] No, should be = 'no' or = false qryMoveMachineSelect.ASSET_NUMBER = [Forms]![frmInstallations]! [Text43], qryMoveMachineSelect.OPENING_METER_1 = [Forms]![frmInstallations]! [txtMeter1], qryMoveMachineSelect.OPENING_METER_2 [Forms]![frmInstallations]! [txtmeter2], missing equals sign qryMoveMachineSelect.OPENING_METER_3 = [Forms]![frmInstallations]! [txtxMeter3], qryMoveMachineSelect.DATE_INSTALLED = [Forms]![frmInstallations]! [txtDate];- Hide quoted text - - Show quoted text - Hi The equals signs are in the query. I built the query using the standard QBE screen. Also I am led to understand that updating two tables is feasible and am trying to understand why this will not work rather than creat two separate queries.. Steve |
#8
| |||
| |||
|
|
Steve_s <stev... (AT) hotmail (DOT) co.uk> wrote innews:aca27a60-602c-4955-9c0d-a87af37750d2 (AT) d8g2000yqf (DOT) googlegroups.com : On 18 July, 16:22, Bob Quintal <rquin... (AT) sPAmpatico (DOT) ca> wrote: Steve_s <stev... (AT) hotmail (DOT) co.uk> wrote innews:9a2196e2-1381-45b3-a156-e790 6a6f7... (AT) q12g2000yqj (DOT) googlegroups.co m: On 17 July, 17:39, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Steve_s wrote: I have an update query which updates fields in two tables. The query is fired from an input form but when the command button is activated the query only changes the fields in one of the tables but fails to change a yes/no field in the second table. If I run the query again the yes/no field in the second table changes as anticipated. I would appreciate some help with this as it has me really confused! Steve What version? *What is the SQL statement? It worked on a statement I ran that looked like this * * * * UPDATE CU INNER JOIN CH ON CU.UnitID = CH.UnitID * * * * SET CU.UnitNum = 40, CH.YN = False * * * * WHERE CU.PartsID=41; Access 2007 The SQL is: UPDATE qryMoveMachineSelect SET qryMoveMachineSelect.[AVAILABLE?] No, qryMoveMachineSelect.ASSET_NUMBER [Forms]![frmInstallations]! [Text43], qryMoveMachineSelect.OPENING_METER_1 = [Forms]! [frmInstallations]![txtMeter1], qryMoveMachineSelect.OPENING_METER_2 [Forms]![frmInstallations]![txtmeter2], qryMoveMachineSelect.OPENING_METER_3 = [Forms]![frmInstallations]! [txtxMeter3], qryMoveMachineSelect.DATE_INSTALLED = [Forms]! [frmInstallations]![txtDate]; Originally I was trying to update directly to the tables but thought that may be the problem so I creaed a select query to get the data but the result was exactly the same Either you miscopied the SQL from your query or you have some messed up statements. When I break down the query into individual statements I see missing equals (=) *signs in 2 places) and missing quotes around a value. UPDATE qryMoveMachineSelect SET qryMoveMachineSelect.[AVAILABLE?] No, should be = 'no' or = false qryMoveMachineSelect.ASSET_NUMBER = [Forms]![frmInstallations]! [Text43], qryMoveMachineSelect.OPENING_METER_1 = [Forms]![frmInstallations]! [txtMeter1], qryMoveMachineSelect.OPENING_METER_2 [Forms]![frmInstallations]! [txtmeter2], missing equals sign qryMoveMachineSelect.OPENING_METER_3 = [Forms]![frmInstallations]! [txtxMeter3], qryMoveMachineSelect.DATE_INSTALLED = [Forms]![frmInstallations]! [txtDate];- Hide quoted text - - Show quoted text - Hi The equals signs are in the query. I built the query using the standard QBE screen. Also I am led to understand that updating two tables is feasible and am trying to understand why this will not work rather than creat two separate queries.. Steve There are several causes where Access, and SQL in general, can create non-updateable queries. Some reasons: three tables in the query, left or right join in the query, no primary key on one or more tables.(Sometimes adding the keys to the queries helps that)- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |