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.
Microsoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
Scott McDaniel (EE MVE )

Post the SQL of the query.
Dale Fye

Sounds like corruption.  Backup the database, then perform a compact and repair.
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;
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Dale Fye

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
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
Dale Fye

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Issa S.

ASKER
Very Comprehensive.
Thanks a Lot Dale.
Dale Fye

glad to help.