I am trying to avoid storing calculated data in my table.
I have a hex grid map Each record in my Map table is a unique hex and the fields store various properties of this hex.
As example: Within the record I store TerrainID, TerrainModID, SettlementId from 3 different linked tables.
I could create a field which is a DLookup calculation based on properties in the Terrain, TerainMod, and Settlement tables. This seems poor practice and I am looking for a better way.
Instead, I have created a query with the relevant data and do the calculations within the query.
MY PROBLEM: I cannot filter the query to the correct record and pull this calculated field back display in my form.
> I cannot filter the query to the correct record and pull this calculated field back display in my form.
Can you share the SQL you've tried?
David HarringtonOP
@Reply 3 years ago
Hi Alex: Here is the SQL for the QUERY. It seems to be working fine when I open the query
SELECT tblLocationsGrandTacticalHex.GTHexID, tblLocationsGrandTacticalHex.TerrainID, tblMapStatTerrain.MaxProvinceLevel, tblLocationsGrandTacticalHex.TerrainModID, tblMapStatTerrainModifiers.ProvinceLevelModifier, [maxprovincelevel]+[provincelevelmodifier] AS HexMaxDevValue, tblMapStatTerrain.MaxAuraLevel, tblMapStatTerrain.MaxAuraLevel AS HexMaxAuraValue
FROM tblMapStatTerrain INNER JOIN (tblMapStatTerrainModifiers INNER JOIN tblLocationsGrandTacticalHex ON tblMapStatTerrainModifiers.TerrainModID = tblLocationsGrandTacticalHex.TerrainModID) ON tblMapStatTerrain.TerrainID = tblLocationsGrandTacticalHex.TerrainID;
I use two combo boxes within the form
HexMaxDevValue has this:
row source SELECT [qryMaxHexDevYAura].[GTHexID], [qryMaxHexDevYAura].[HexMaxDevValue] FROM qryMaxHexDevYAura;
control source HexMaxDevValue which is a field in 'tblLocationsGrandTacticalHex.
HexMaxAuraValue has this
row source SELECT [qryMaxHexDevYAura].[GTHexID], [qryMaxHexDevYAura].[HexMaxAuraValue] FROM qryMaxHexDevYAura;
control source HexMaxAuraValue which is a field in 'control source HexMaxDevValue which is a field in 'tblLocationsGrandTacticalHex.
The form only updates when I move off the record and then return
The tblLocationsGrandTacticalHex is not updating at all
Those table/field names hurt my eye. Simplify it, please. All I see is a jumble of letters.
David HarringtonOP
@Reply 3 years ago
Hi Richard
Having grown up with QBasic and the single letter cryptic variable names, I have now fully embraced long cryptic variable names.
Monitors give us enough eye stain without me adding to the problem. Hopefully this is better! I've attempted to use your T and Q suffixes for readability.
SELECT LocationT.HexID, LocationT.TerrainID, TerrainT.DLevel, LocationT.TerrainModID, TerrainModT.DModifier, [Dlevel]+[DModifier] AS MaxDValue, TerrainT.ALevel, TerrainT.ALevel AS MaxAValue FROM TerrainT INNER JOIN (TerrainModT INNER JOIN LocationT ON TerrainModT.TerrainModID = LocationT.TerrainModID) ON TerrainT.TerrainID = LocationT.TerrainID;
I use two combo boxes within the form
MaxDValue has this:
row source: SELECT [DandAQ].[HexID], [DandAQ].[MaxDValue] FROM DandAQ;
control source: MaxDValue which is a field in 'LocationT.
MaxAValue has this
row source: SELECT [DandAQ].[HexID], [DandAQ].[MaxAValue] FROM DandAQ;
control source: MaxAValue which is a field in LocationT.
The form only updates when I move off the record and then return
The LocationT is not updating at all
David HarringtonOP
@Reply 3 years ago
Hi Richard and Alex:
I have found my problem. I was doing an after_update requery event, but on a dirty record. I added a me.refresh above the requery and all is well.
David
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Expert 1.