dbTalk Databases Forums  

Update Query Problem

comp.databases.ms-access comp.databases.ms-access


Discuss Update Query Problem in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Steve_s
 
Posts: n/a

Default Update Query Problem - 07-17-2010 , 07:06 AM






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

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Update Query Problem - 07-17-2010 , 11:39 AM






Steve_s wrote:
Quote:
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;

Reply With Quote
  #3  
Old   
Steve_s
 
Posts: n/a

Default Re: Update Query Problem - 07-18-2010 , 03:07 AM



On 17 July, 17:39, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
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

Reply With Quote
  #4  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Update Query Problem - 07-18-2010 , 10:02 AM



Why do you need to do both fields at once?
This seems to be a job for two update queries.

Steve_s wrote:
Quote:
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

Reply With Quote
  #5  
Old   
Bob Quintal
 
Posts: n/a

Default Re: Update Query Problem - 07-18-2010 , 10:22 AM



Steve_s <stevo.s (AT) hotmail (DOT) co.uk> wrote in
news:9a2196e2-1381-45b3-a156-e7906a6f7d44 (AT) q12g2000yqj (DOT) googlegroups.co
m:

Quote:
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];

Reply With Quote
  #6  
Old   
Steve_s
 
Posts: n/a

Default Re: Update Query Problem - 07-19-2010 , 07:22 AM



On 18 July, 16:22, Bob Quintal <rquin... (AT) sPAmpatico (DOT) ca> wrote:
Quote:
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 -
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

Reply With Quote
  #7  
Old   
Bob Quintal
 
Posts: n/a

Default Re: Update Query Problem - 07-19-2010 , 05:17 PM



Steve_s <stevo.s (AT) hotmail (DOT) co.uk> wrote in
news:aca27a60-602c-4955-9c0d-a87af37750d2 (AT) d8g2000yqf (DOT) googlegroups.com
:

Quote:
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

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)

Reply With Quote
  #8  
Old   
Steve_s
 
Posts: n/a

Default Re: Update Query Problem - 07-20-2010 , 12:19 PM



On 19 July, 23:17, Bob Quintal <rquin... (AT) sPAmpatico (DOT) ca> wrote:
Quote:
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 -
Thanks for your help...I managed to figure out my problem which was
down to poor design on my part. I had been using the wrong field for
the initial select query. Also, this field was updated when the update
query was run initially to the value of the record which had the
available? yes/no field which was why the yes/no field was updated
when I ran the query again....By altering my select query to inlude
the correct fields the update query runs as anticipated. Thanks for
your input and sorry for wasting your time...I will however remember
the lesson well as I have been looking at this on and off for weeks
and I will keep in mind the the points you have made re non updateable
queries

Steve

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.