ACCESS: Use a while statement as suggested by _sev in the merge request

Also fix a formatting issue pointed out by _sev