472,110 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,110 software developers and data experts.

syntax error for Update Query


I have this update query that I am trying to run. I know the syntax is
messed up but do not know how to correct it.

Select 'UPDATE', Transactions,'Set [balance] =[Daily Balance] where [Id]=
[Idalias]' From "Get Daily Balances"

Transactions = name of the table I want to update
balance = name of the field i want to update

daily balance= name of the query result that I want to move to the table
(this is the result of a Dsum)

ID=primary key in the table
IDalias = the query resulting copy of the ID number

Get daily balances = the name of the query that I need to update from

Thanks in advance for the help on writng the query correctly

Mark
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200507/1
Nov 13 '05 #1
7 3370
Mark Carlyle via AccessMonster.com wrote:
I have this update query that I am trying to run. I know the syntax is
messed up but do not know how to correct it.

Select 'UPDATE', Transactions,'Set [balance] =[Daily Balance] where [Id]=
[Idalias]' From "Get Daily Balances"

Transactions = name of the table I want to update
balance = name of the field i want to update

daily balance= name of the query result that I want to move to the table
(this is the result of a Dsum)

ID=primary key in the table
IDalias = the query resulting copy of the ID number

Get daily balances = the name of the query that I need to update from

Thanks in advance for the help on writng the query correctly

Mark

Can you use Access to create it? Open up the query designer
(Query/New/Design) and select/add table/query Transactions and "Get
Daily Balances". If needed, create a relationship line between the ID
fields. Now, drag the Balance field from Transactions. From the menu
select Query/Update to change it to an update query. In the Update row
for Balance, enter [Get Daily Balances]![Daily Balance]. Save and run.

You should end up with a query similar to this.

UPDATE Transactions INNER JOIN [Get Daily Balances] ON Transactions.ID =
[Get Daily Balances].IDAlias SET Transactions.Balance = [Get Daily
Balances]![Daily Balance];

Just curious. Why do people put spaces into table and query names? To
create more work for themselves?
Nov 13 '05 #2
Mark Carlyle via AccessMonster.com wrote:
I have this update query that I am trying to run. I know the syntax is
messed up but do not know how to correct it.

Select 'UPDATE', Transactions,'Set [balance] =[Daily Balance] where [Id]=
[Idalias]' From "Get Daily Balances"

Transactions = name of the table I want to update
balance = name of the field i want to update

daily balance= name of the query result that I want to move to the table
(this is the result of a Dsum)

ID=primary key in the table
IDalias = the query resulting copy of the ID number

Get daily balances = the name of the query that I need to update from

Thanks in advance for the help on writng the query correctly

Mark

Can you use Access to create it? Open up the query designer
(Query/New/Design) and select/add table/query Transactions and "Get
Daily Balances". If needed, create a relationship line between the ID
fields. Now, drag the Balance field from Transactions. From the menu
select Query/Update to change it to an update query. In the Update row
for Balance, enter [Get Daily Balances]![Daily Balance]. Save and run.

You should end up with a query similar to this.

UPDATE Transactions INNER JOIN [Get Daily Balances] ON Transactions.ID =
[Get Daily Balances].IDAlias SET Transactions.Balance = [Get Daily
Balances]![Daily Balance];

Just curious. Why do people put spaces into table and query names? To
create more work for themselves?
Nov 13 '05 #3

Ok I get an error message that says "Operation must contain an updateable
Query"

Transactions is a table... Get Daily Balances is a Query of Transactions.

Salad wrote:
I have this update query that I am trying to run. I know the syntax is
messed up but do not know how to correct it.

[quoted text clipped - 16 lines]

Mark


Can you use Access to create it? Open up the query designer
(Query/New/Design) and select/add table/query Transactions and "Get
Daily Balances". If needed, create a relationship line between the ID
fields. Now, drag the Balance field from Transactions. From the menu
select Query/Update to change it to an update query. In the Update row
for Balance, enter [Get Daily Balances]![Daily Balance]. Save and run.

You should end up with a query similar to this.

UPDATE Transactions INNER JOIN [Get Daily Balances] ON Transactions.ID =
[Get Daily Balances].IDAlias SET Transactions.Balance = [Get Daily
Balances]![Daily Balance];

Just curious. Why do people put spaces into table and query names? To
create more work for themselves?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200507/1
Nov 13 '05 #4
Mark Carlyle via AccessMonster.com wrote:
Ok I get an error message that says "Operation must contain an updateable
Query"
Most likely [Get Daily Balances] uses a Totals query in it or else is a
Totals query. If so, you'll need to adjust your method of updating and
not use a Total query.
Transactions is a table... Get Daily Balances is a Query of Transactions.

Salad wrote:
I have this update query that I am trying to run. I know the syntax is
messed up but do not know how to correct it.


[quoted text clipped - 16 lines]
Mark


Can you use Access to create it? Open up the query designer
(Query/New/Design) and select/add table/query Transactions and "Get
Daily Balances". If needed, create a relationship line between the ID
fields. Now, drag the Balance field from Transactions. From the menu
select Query/Update to change it to an update query. In the Update row
for Balance, enter [Get Daily Balances]![Daily Balance]. Save and run.

You should end up with a query similar to this.

UPDATE Transactions INNER JOIN [Get Daily Balances] ON Transactions.ID =
[Get Daily Balances].IDAlias SET Transactions.Balance = [Get Daily
Balances]![Daily Balance];

Just curious. Why do people put spaces into table and query names? To
create more work for themselves?


Nov 13 '05 #5

[Get Daily Balances] is a Dsum Query of a Totals Query.

What I need to do is update a table with the results of the Dsum Query.

Am I going about this all wrong?

Salad wrote:
Ok I get an error message that says "Operation must contain an updateable
Query"


Most likely [Get Daily Balances] uses a Totals query in it or else is a
Totals query. If so, you'll need to adjust your method of updating and
not use a Total query.
Transactions is a table... Get Daily Balances is a Query of Transactions.

[quoted text clipped - 20 lines]
Just curious. Why do people put spaces into table and query names? To
create more work for themselves?

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #6
Mark Carlyle via AccessMonster.com wrote:
[Get Daily Balances] is a Dsum Query of a Totals Query.

What I need to do is update a table with the results of the Dsum Query.

Am I going about this all wrong?
Yes, if you are attempting to update from a Totals query.

You need to change your methodology of getting the balance.

Salad wrote:
Ok I get an error message that says "Operation must contain an updateable
Query"


Most likely [Get Daily Balances] uses a Totals query in it or else is a
Totals query. If so, you'll need to adjust your method of updating and
not use a Total query.

Transactions is a table... Get Daily Balances is a Query of Transactions.


[quoted text clipped - 20 lines]
Just curious. Why do people put spaces into table and query names? To
create more work for themselves?


Nov 13 '05 #7

Well, I figured out finally that there is no need to store the balance... why
not just create a query that gives the balance along with the other info I
wish to view.

Thanks a ton for your help!

Salad wrote:
[Get Daily Balances] is a Dsum Query of a Totals Query.

What I need to do is update a table with the results of the Dsum Query.

Am I going about this all wrong?


Yes, if you are attempting to update from a Totals query.

You need to change your methodology of getting the balance.
Ok I get an error message that says "Operation must contain an updateable
Query"[quoted text clipped - 9 lines]>Just curious. Why do people put spaces into table and query names? To
>create more work for themselves?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200507/1
Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by DFS | last post: by
reply views Thread by Mark Carlyle via AccessMonster.com | last post: by
5 posts views Thread by Chris Kennedy | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.