Using the barcode scanner to automatically look up item

I’m trying to save our school some money and create a base that allows me to use the barcode scanner to keep track of the students in the breakfast program. I want to use the barcode scanner to scan their student id when i create a new record. I have one table set up with the students info, but how do i get the other table to look up the barcode i just scanned, and see it as the student? I’m having a hard time with the logic.