Mark O'Brien
MrExcel MVP
- Joined
- Feb 15, 2002
- Messages
- 3,530
Ok, I think I've got to grips with relational databases. I can understand SQL or at least can work out what I want to do and how I'm going to do it.
I have a question about queries though, since I am not skilled in Access.
I'll present a trivial example.
Suppose, for example, I have a combobox on a VBA userform and I want the combobox to contain the result of a query e.g.:
SELECT DISTINCT tblPlantUnit.PLANT
FROM tblPlantUnit;
Now, this query is contained "Row Source" property of the combobox itself, it is not a separate query.
What I would like an opinion on is if I should make this a separate query? e.g. put it into a query called qryListPlants.
I do not think that I will need to use this query in any other control, which would be the obvious advantage of creating a separate query.
Would I gain any advantage by explicitly creating all of my queries in this manner? I would imagine it would be easier to modify and maintain my DB at a later stage if I didn't have to go hunting in all of my userforms for these queries.
Thanks
PS. I'm not really "with it" on the Access speak, so if anyone can correct my terminology I'd appreciate it.
EDIT:: Also, would another advantage for keeping my queries all in one place would be if I want to execute some queries from VBA? e.g. suppose on my combobox above, I want to populate another combobox based on the text selected in the first combobox.
I have a question about queries though, since I am not skilled in Access.
I'll present a trivial example.
Suppose, for example, I have a combobox on a VBA userform and I want the combobox to contain the result of a query e.g.:
SELECT DISTINCT tblPlantUnit.PLANT
FROM tblPlantUnit;
Now, this query is contained "Row Source" property of the combobox itself, it is not a separate query.
What I would like an opinion on is if I should make this a separate query? e.g. put it into a query called qryListPlants.
I do not think that I will need to use this query in any other control, which would be the obvious advantage of creating a separate query.
Would I gain any advantage by explicitly creating all of my queries in this manner? I would imagine it would be easier to modify and maintain my DB at a later stage if I didn't have to go hunting in all of my userforms for these queries.
Thanks
PS. I'm not really "with it" on the Access speak, so if anyone can correct my terminology I'd appreciate it.
EDIT:: Also, would another advantage for keeping my queries all in one place would be if I want to execute some queries from VBA? e.g. suppose on my combobox above, I want to populate another combobox based on the text selected in the first combobox.