Skip to content
Advertisement

Self Join with dynamic clause / criteria in Access VBA

In this dummy table I would like to Update the PreviousARowno column with the following logic: the PreviousARowno value should be the Row Number of the previous most recent Date where Estimate is A, so it shoud look like this:

Any ideas or suggestions on how I could update that column? I’ve tried different self joins with select top 1 statements but I cant make it work dynamically. If the date for the previous A is a known-prefixed value then I know how to do it but unfortunately is unknown. By the way I’ve added the RowNo column for that reason so it can be used as a criteria for the joins.

Advertisement

Answer

You can do this with a correlated subquery:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement