David Ball
Registered User.
- Local time
- Today, 22:41
- Joined
- Aug 9, 2010
- Messages
- 230
Hi,
In Access I have a query with a field, BERTHING F, that needs to have a date calculated based on the “ARRIVALCF” date and the “DepartDate”. The first date in the BERTHINGF column, 04-Jul-15, is hard coded in the table and does not change.
I need to have a date that is equal to the “ARRIVALCF” date, if that is later than the date in DepartDate for the row above, or use DepartDate + 1 day..
It is basically saying, a ship can berth on its arrival date, unless the previous ship is still berthed.
Also, the query is sorted by ARRIVALCF date ascending, so the order may change as arrival dates are updated in the main table. (I.e. I can’t just have a fixed ID number for each row and somehow use that in my formula).
This is OK in Excel because we can have a formula like =IF(M13>Q12,M13,Q12+1), but how can we refer to a value in a row above in Access?
Can this be done?
I have attached a diagram to try to make it a bit easier to understand.
Thanks
Dave
In Access I have a query with a field, BERTHING F, that needs to have a date calculated based on the “ARRIVALCF” date and the “DepartDate”. The first date in the BERTHINGF column, 04-Jul-15, is hard coded in the table and does not change.
I need to have a date that is equal to the “ARRIVALCF” date, if that is later than the date in DepartDate for the row above, or use DepartDate + 1 day..
It is basically saying, a ship can berth on its arrival date, unless the previous ship is still berthed.
Also, the query is sorted by ARRIVALCF date ascending, so the order may change as arrival dates are updated in the main table. (I.e. I can’t just have a fixed ID number for each row and somehow use that in my formula).
This is OK in Excel because we can have a formula like =IF(M13>Q12,M13,Q12+1), but how can we refer to a value in a row above in Access?
Can this be done?
I have attached a diagram to try to make it a bit easier to understand.
Thanks
Dave