How to add a text field (seemingly) to a complex select query.

My user wants to add a read-write row level field to a form backed by a complex select query where all existing tables are read-only. I can add a new table to the database with the necessary key fields to link it to the rows of select query, but I would like some guidance with the best approach including the methods to add the record and update fields. My VBA experience is mostly with Excel, but have written several simple Access applications.

I would like the field to appear in the form as if the field is always present even though it is not. I understand I will have to requery the form data and the user will experience some screen flashing.
WilbertWaterburyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Complex select queries are rarely updateable, so if the current query is NOT updatedable, then adding another table won't help matters - and you cannot identify specific Tables/Fields in your Query that should be updateable, while leaving others as non-updateable.

If you can make the query updateable, then you could simply set the Form Controls (i.e. the textboxes, dropdowns, etc) to Enabled = True and Locked = False. This would stop user from modifying those fields, and you could leave your new field as a read/write value.

As I mentioned earlier, however, this all depends on if you can make that complex query updateable ...

If you like, you could use SQL/VBA to handle this, perhaps in the AfterUpdate event of your textbox. Something like this:

Sub MyControl_AfterUpdate()
  Currentdb.Execute "UPDATE SomeTable SET SomeField='" & Me.MyControl & "' WHERE IDField=" & YourIDValue
End Sub

Obviously, you'd have to change the names of Tables and Fields to match those in your database.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Armen Stein - Microsoft Access MVP since 2006PresidentCommented:
Or, you could put the one updatable field in a tiny subform that's related to the main form using Master/Child properties.

Armen Stein
0
WilbertWaterburyAuthor Commented:
Thank you both @ScottMcDaniel and @ArmenStein. I am considering both of your comments and will respond shortly.
0
WilbertWaterburyAuthor Commented:
@Scott's UPDATE command was the ticket (plus an add record if one did not already exist) and was a huge help thanks to you both for your ideas!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.