You don't even need the button for this. If you search this forum, using the keyword Bar Code, you'll find a number of discussions of the following generalized approach.
Configure your scanner to precede the scanned text with a Character or combination of characters.
On your layout setup an onKestroke script trigger that checks for this character combination (I use at least one modifier key to help avoid accidentally triggering this from the keyboard). When it detects this combination, it selects the appropriate layout and uses either Go To Field or Go To Object to place the cursor in the field you want to use to receive the scanned data. Often, this is a global text field as scripts that perform finds can easily refer to the contents of this field while in find mode.
Configure your scanner to append a tab, return or enter keystroke to the end of the scan. Set up your text field's behavior so that this same keystroke exits the field. Set an OnObjectExit Trigger on this field to perform a script that performs your check in / out procedure.
I'm really new to this, could you explain how I would set this all up?
Have you done this? Enter bar code in the search the forum box at top right and see what comes up.
It's been discussed a number of times and the details can vary depending on how you set up your tables to log the equipment in or out. How you set up your scanner to put text at the begginning and end of the scanned data requires reading the user manual for your specific scanner or contacting the manufacturer's tech support if you can't find it in the manual. (This will be different for different scanners, but almost all can do this.)
Do you want one record for each type of equipment that lists its status as "in" or "out"?
Or do you want a table where each time equipment is logged out, a new record is created recording the date, time, type of equipment and the name of the person checking it out? Then checking it back end would be a process that finds this last record and logs the date, time returned in a second field.
That's just one possible variation here.