Exodus 34:7 says that God “[visits] the iniquity of the fathers on the children and the children’s children, to the third and the fourth generation” (ESV).
The limit of living influence
This evidently has nothing to do with the consequence of Adam’s sin – such as discussed in Romans, but is related to family and society in the span of living knowledge. In other words it is possible for the grandfathers and great-grandfathers to directly influence the fourth generation, but beyond that – due to the limit of human lifespan – no direct influence is possible.
And is this God, or men themselves?
The initial statements do appear to show that it is God inflicting the judgement:
The Lord…visits the iniquity of the fathers on the children and the children’s children, to the third and the fourth generation. (Exodus 34:6-7 = Deuteronomy 5:8-10)
“Because of their iniquity, and also because of the iniquities of their fathers they shall rot away like them.” (Leviticus 26:39)
But the Bible also makes clear that this is a social generalization, something that God did in relation to society, and in particular his witness-nation to the Gentiles, Israel:
Fathers shall not be put to death because of their children, nor shall children be put to death because of their fathers.” (Deuteronomy 24:16)
[Amaziah] did not put to death the children of the murderers, according to what is written in the Book of the Law of Moses, where the Lord commanded, “Fathers shall not be put to death because of their children, nor shall children be put to death because of their fathers. But each one shall die for his own sin.” (2 Kings 14:6)
The son shall not suffer for the iniquity of the father, nor the father suffer for the iniquity of the son. (Ezekiel 18:20, cf. Jeremiah 31:30)
Reconciling these statements
The most natural conclusion from balancing the above is that God does let the judgements on one generation carry to the next. And in the case of Israel repeatedly inflicted judgements – the sentence to 40 years in the wilderness, the deportation for 70 years to Babylon, most tragically the 19 centuries from AD70 to 1948 for national Israel – that carries a certain unfairness, other than that life for sinners is not ‘fair’ other than from comparison with the life of the sinless One Jesus who is the only descendant of Adam who could justly say that life was not fair.
But there’s a second conclusion from those verses too. Great-grandparents, grandparents and parents do have a responsibility to their children and children’s children. Likewise children, grandchildren, and great-grandchildren can break the pattern of bad example shown to them.
Additional comment from Joe H.
‘Thou shalt not bow down thyself to them, nor serve them: for I the LORD thy God am a jealous God, visiting the iniquity of the fathers upon the children unto the third and fourth generation of them that hate me;’ (Exod 20:5 and repeated in Deut 5:9).
I have always viewed this statement as a measure of God’s patience. He will not visit immediate retribution upon the wicked, rather He will allow time for their descendants to make their choices too (as for example king Manasseh followed by Amon). This does not exclude a degree of local punishment but it is not the full measure that their sins deserve. This pattern occurs in the NT as Jesus warns the rulers to ‘fill up the measure of their fathers.’ Eventually, however, when (as for example the iniquity of the Amorites) there will come a point when final, decisive action will be taken.
Additional comment from Dan W.
I think the most important thing about this question from Exodus 34 is that when you’re reading that, you’re supposed to have already read Exodus 20 which this declaration is partially repeating: