You are right.
You can use a shiftregister for this problem. In a while wait until the key is pressed then go into another while and measure your signal, compare the measured value with the previous value and decide whether or not to stop. The previous value can be read from a shiftregister that is filled in the while.
Depending on the measurement speed you can use single reads or blockreads. You can look this up in the DAQ examples.
Timing is best measured with the tick counts (ms) function. Just before you enter the measuring while and just behind the measuring while. Use a single sequence frame before and after the while to be sure that the tick count is measured at the correct moment
greetings from the Netherlands