H
Hoppy Brewing
I have a looped VBA function that I'd like to replace with a query.
Basically it is a yeast generation counter for a brewery. The yeast from one
fermentation is used for the next one, starting from a fresh pitch
occasionally (generation 0).
The function uses a loop to create a 1-record recordset from a parameter
query. The query looks like:
PARAMETERS parOne Long;
SELECT SubFermentationLogBrew.FermentationLogID,
SubFermentationLogBrew_1.FermentationLogID
FROM (SubFermentationLogBrew INNER JOIN SubBrewingLogTransfer ON
SubFermentationLogBrew.BrewingLogID = SubBrewingLogTransfer.BrewingLogID)
INNER JOIN SubFermentationLogBrew AS SubFermentationLogBrew_1 ON
SubBrewingLogTransfer.YeastFrom = SubFermentationLogBrew_1.FermentationLogID
WHERE (((SubFermentationLogBrew.FermentationLogID)=[parOne]));
SubFermentationLogBrew links Fermentations to Brews. SubBrewingLogTransfer
records the previous Fermentation from which the yeast came.
FermentationLogID is the primary key from the main FermentationLog that is
recorded in the SubBrewingLogTransfer.YeastFrom. That last field is Null at
the 0 generation of the yeast.
The second field's value is fed into the query as a new parameter, looped,
and away we go. It works, but ever since we split the db (server remote on a
fairly new computer, there are watches more powerful than the client's home)
the speed has slowed dramatically.
So I was wondering if there is a way to write a SQL in such a fashion that
all the records of the yeast's lineage will be returned in one recordset. I
assume this will be faster than accessing the server for one record many
times.
Thanks for any help you can give me.
Basically it is a yeast generation counter for a brewery. The yeast from one
fermentation is used for the next one, starting from a fresh pitch
occasionally (generation 0).
The function uses a loop to create a 1-record recordset from a parameter
query. The query looks like:
PARAMETERS parOne Long;
SELECT SubFermentationLogBrew.FermentationLogID,
SubFermentationLogBrew_1.FermentationLogID
FROM (SubFermentationLogBrew INNER JOIN SubBrewingLogTransfer ON
SubFermentationLogBrew.BrewingLogID = SubBrewingLogTransfer.BrewingLogID)
INNER JOIN SubFermentationLogBrew AS SubFermentationLogBrew_1 ON
SubBrewingLogTransfer.YeastFrom = SubFermentationLogBrew_1.FermentationLogID
WHERE (((SubFermentationLogBrew.FermentationLogID)=[parOne]));
SubFermentationLogBrew links Fermentations to Brews. SubBrewingLogTransfer
records the previous Fermentation from which the yeast came.
FermentationLogID is the primary key from the main FermentationLog that is
recorded in the SubBrewingLogTransfer.YeastFrom. That last field is Null at
the 0 generation of the yeast.
The second field's value is fed into the query as a new parameter, looped,
and away we go. It works, but ever since we split the db (server remote on a
fairly new computer, there are watches more powerful than the client's home)
the speed has slowed dramatically.
So I was wondering if there is a way to write a SQL in such a fashion that
all the records of the yeast's lineage will be returned in one recordset. I
assume this will be faster than accessing the server for one record many
times.
Thanks for any help you can give me.