Forum Discussion
Update a text box ControlSource with VBA
and yes, my goal is to basically store the location of the data source in the form, but if the data source gets moved someone with no experience needs to be able to update it. So my plan was to have the location as the data source for a text box, then just update it as needed.
chipmunkwhiz No apologies needed. It's just that sometimes we have been known to answer the wrong question based on faulty assumptions.
In this case, you do need to create a table to store the location. Bind the field with that value to the control on the form. You can update it as needed, based on the code shown. Or, you can use a DLookup to get it when needed from the table.
Keep in mind that forms are the interface to the data, not the actual data. Persisting data requires tables.
At the risk of going too far into the details, all relational database applications include three components:
Data Tier: Tables holding the data.
Interface Tier: The interface objects used to interact with your data; forms, reports
Logic Tier: Code that manipulates both interface and data.
Queries are hard to classify because in some ways they are part of the interface in that they are used to retrieve data for forms and reports from tables. They are also part of the logic in that they are used to update, add and delete data from tables.
So, here you want to persist data values. That calls for a table, but you can DISPLAY them in the interface, i.e. in a control on a form.
- chipmunkwhizJun 06, 2022Copper Contributorperfect, thank you for the info.
I'll store the location in its own database then.- George_HepworthJun 07, 2022Silver ContributorYou don't need a separate database. Create a table in this same database for this sort of information.