Link to home
Create AccountLog in
Avatar of Issa S.
Issa S.

asked on

Select Query By design Can Not Convert To Update Query !

Select Query By design Can Not Convert To Update Query !

After I Designed my Select Query and checked it getting the required data, I tried to Convert it to become Update. First it did not ask me for the table to update, as normally should do. I tried to define the destination table fields, but it is not recognizing the destination table or its fields.
Upon saving, it clears every thing!

Any help will be highly appreciated.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Post the SQL of the query.
Sounds like corruption.  Backup the database, then perform a compact and repair.
Avatar of Issa S.
Issa S.

ASKER

In Fact I did the Compact minutes before this thing started.
First time I face something like this.
Below is the select SQL for your kind inspection and advice. . . . Thanks.

SELECT collects.ID, collects.voucher, collects.dname, collects.cname, collects.payment, collects.usamount, collects.Date, collects.voucher, collects.sanad, collects.amount, collects.retvalue, collects.daccount, collects.caccount, collects.remarks, collects.chno, collects.chdate, collects.withdr, collects.withdrb, collects.branch, collects.nome, collects.salesm, collects.collection, collects.times, collects.chdate, collects.chdate
FROM [Get Old Cheque ID LAST One] INNER JOIN collects ON [Get Old Cheque ID LAST One].MaxOfID = collects.ID
ORDER BY collects.ID DESC;
Although I doubt it makes a difference here, "Date" is a reserved word.  I recommend that you make that field name more descriptive if you can (like you did with chDate).  If you cannot make that change, then I would strongly recommend that you wrap that field name in brackets:

collects.[Date]

What is it you are trying to update, something in Collects with something from your query [Get Old Cheque ID Last One]?  Generally a query will not be updateable if it includes any aggregates, and it looks like your query with the MaxID might do that.  

But you also made the comment:  "I tried to define the destination table fields" which implies that you are actually trying to append this data into another table, and there shouldn't be anything here preventing that.

Dale
Avatar of Issa S.

ASKER

Yes, you are right. I found that I used Grouping.

But how can you avoid using Grouping if you need to pick the last or the Max of FK and use it since it selects correctly and works well with Make, Append, Not Sure about CrossTab.

The easiest for me was to keep the current logic and use a buffer (Make) table that I delete on every entry. Then Make.

Thanks For your help.
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Issa S.

ASKER

Hi Dale,,,

Amazing.  That is also my way. In cases am not sure of something, I use a temp field with the ID key so don't miss the correct one. This is only spontaneous and for Updating immediately only since you can not rely on IDs changing with other operations like delete and add.

Thanks
Avatar of Issa S.

ASKER

Very Comprehensive.
Thanks a Lot Dale.
glad to help.