Hi. I think you got that error because your SQL statement starts with a quote. Try to copy and paste the exact text from the Immediate Window or the Message Box (not the one from the VBA code).OK, I did as suggested in post #17 and this is what I got:
View attachment 84703
Something odd going on here: The statement starts "UPDATE", but the error is that the statement doesn't start with "UPDATE"....Huh???
The syntax is apparently right, as I don't get a "compile error"....
@Gasman, in answer to your question " Do you have a query called Aircraft, and if so how many fields are in it.? " I have attached a screen shot of the Queries, from which you can see there is no Query called "Aircraft" (just a table whose fields are shown in post #6), though there is a query called "Aircraft Query" (as I look back on this, I wonder what I was thinking of when I broke all the rules of good practice when I wrote it. It must offend all your sensibilities, for which I am deeply sorry)
View attachment 84704
Hi. How about creating another query with this SQL statement?OK, something sensible here...I did as @Gasman suggested, and this is what I got back:
View attachment 84705
So although there is a "Completed?" field in the "Airframe" table, the query apparently can't find it, despite having the right "Airframe Number", so asks for the value. As far as I can make out, the "missing parameter" of the original error is the lack of a "Completed?" value.
Is this likely to be something to do with the fact that I added the "Completed?" field long after the table and most of the content was created, and could this be because the yes/no status of the field is inclear. I know the value should be either -1 or 0, but if I just created the field, do I need to initialise it somehow, to drive it to one state or another? or does it default to a predefined status?
SELECT [Airfram Number], [Completed?] FROM Aircraft
Completed and completed? Are different ????
It's a very good point you make, my only defence being that I wrote this DB originally back in the mid '90s, and was (badly) teaching myself Access at the time; best practices were abandoned in favour of anything that worked...I didn't expect the DB to still be operational this far on, and I'm now wondering if it may be wise to rewrite it with best practices in mind. I don't use Access at all professionally, I build networks, thats why I'm so bad at it and so grateful to this forum and its participants. Thanks!I'm sure all were happy to participate/share thoughts.
An old tip is Do NOT include embedded spaces nor special characters** in field names.
** non-alphanumeric (eg. !@#$%^&*?+=_-......)
In fact you were showing Completed? in your pics, but I was not sure if captions were shown on table view? Obvioulsy they are and I have just tested on my Test DB. I could see this being what I call a 'silly' error. Hard to track down, and when you do, it's Doh!.@Gasman ....Oh, good grief! You have nailed it. The field name in design view is "Complete", but I was referring to it as "Complete?" You will read this tomorrow, as you have gone to bed, but your parting action was to fix the problem! Sleep well, you deserve it.
I changed the original query to use the right name and Bingo! it works perfectly.
There are several (fairly critical) names I'd like to call myself, as I'm sure, would you!
Thanks and Kudos are due to Gasman, theDBguy and Isaac, you guys have been great, and I owe you all! (And thanks to jdraw for being brave enough to volunteer to get involved in the mess I created!)