Using one keypad for multiple different locks?

I have an Arduino Elegoo Uno R3 and a Vsionic keypad with multiple user codes. I was wondering if there was a way to program it so each user code unlocked a different cabinet via magnetic lock?

I've successfully used a single keypad for a single lock, but google isn't really helping me figure this out, possibly due to vague wording on my part.

Any help in the right direction would be greatly appreciated. Thanks!

Sorry for not bothering to dig up particulars on your keypad but if it's just a keypad entering a code, it should be quite simple to open different things depending on the code entered, something in the lines of:

if (code = "1234") unlockCabinetOne();
if (code = "2345") unlockCabinetTwo();
if (code = "666") unlockHell();

Great! I was hoping it'd be as simple as that, but I hadn't found anything to support it. That makes my life so much easier.

can you be a bit more specific with the answer ?
i want to do the same but am not handy in the code
heres what i got (borrowed) so far

#include <Password.h> //http://playground.arduino.cc/uploads/Code/Password.zip //tells to use password library
#include <Keypad.h> //http://www.arduino.cc/playground/uploads/Code/Keypad.zip  //tells to use keypad library
#include <Servo.h> //tells to use servo library


Servo myservo; //declares servo
Password password = Password( "0000" ); //password to unlock, can be changed

const byte ROWS = 4; // Four rows
const byte COLS = 4; // columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 9, 8, 7, 6 };// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 5, 4, 3 };


// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
  Serial.write(254);
  Serial.write(0x01);
  delay(200); 
  pinMode(11, OUTPUT);  //green light
  pinMode(12, OUTPUT);  //red light
  myservo.attach(13); //servo on digital pin 9 //servo
  keypad.addEventListener(keypadEvent); //add an event listener for this keypad
  }

void loop(){
  keypad.getKey();
  myservo.write(0);
  }
  //take care of some special events
  void keypadEvent(KeypadEvent eKey){
  switch (keypad.getState()){
  case PRESSED:
  
  Serial.print("Enter:");
  Serial.println(eKey);
  delay(10);
  
  Serial.write(254);
  
  switch (eKey){
    case '*': checkPassword(); delay(1); break;
    
    case '#': password.reset(); delay(1); break;
    
     default: password.append(eKey); delay(1);
}
}
}
void checkPassword(){
  
if (password.evaluate()){  //if password is right open
    
    Serial.println("Accepted");
    Serial.write(254);delay(10);
    //Add code to run if it works
    myservo.write(150); //deg
    
        digitalWrite(11, HIGH);//turn on
    delay(5000); //wait 5 seconds
    digitalWrite(11, LOW);// turn off
    
    
}else{
    Serial.println("Denied"); //if passwords wrong keep locked
    Serial.write(254);delay(10);
    //add code to run if it did not work
    myservo.write(0);
    digitalWrite(12, HIGH); //turn on
    delay(500); //wait 5 seconds
    digitalWrite(12, LOW);//turn off
    
}
}

Please at least format your code halfway decent before posting - it's a mess and hard to read now. The autoformat function of the IDE goes a long way to get brackets at the right indentation and so.

Next: please explain what this code does, and how this is different from what you want it to do.