You get home after a long day at work (or a long night out), and you reach into your purse or pocket to find your keys. But … oh no. They aren’t there. You search futilely for a few more seconds, rummaging through spare change and various other doodads, but there’s nothing. You’re officially locked out.

Now what?

Locking yourself out of your apartment is one of the most frustrating feelings, especially if you can envision exactly where your keys are, hanging on that key hook just inside the door. At this point, there are a few steps you can take to get inside your apartment.

Call Your Roommate

If you have a roommate, you may be in luck: Even if you have to wait for him or her to get home, at least you won’t have to take more dramatic measures to gain entry. Give your roommate a call to see when he or she is planning on coming home.

If it’s not going to be for a while, you can either go pick up his or her keys or head to a coffee shop or restaurant and hang out for a couple of hours while you wait. Buy yourself a pastry pick-me-up, and you’ll have a grand time.

Call Your Landlord

If you don’t have a roommate, or your roommate is out of town or otherwise not going to be home by the time you need to get inside, you may need to give your landlord or building manager a call. Typically, these people will have a spare key, just in case they need to get into the apartment for maintenance or an emergency.

Keep in mind that if you go to your landlord, building manager, or even doorman to tell him or her you’re locked out, you may have to pay a fee, typically between $25 and $100 depending on where you live.

Find a Local Locksmith

So, you don’t have a roommate and your landlord is MIA. What do you do at this point? As a last resort, you may want to call a local locksmith, who can change out the lock for you and let you in. There are a few reasons this should be your final step, though.

For one thing, if you get your lock changed, your landlord still may charge you a fee, which means you’ll be paying both for that and to have the locksmith change the lock. For another, if the locksmith causes any damage to the door or doorjamb, your landlord will likely charge you for that as well, even if it’s just taken out of your security deposit.

Look for Another Way In

If you want to avoid looking up a local locksmith, you can always try to find another way into your apartment. For people who live in high rises or otherwise difficult-to-access apartment buildings, you may be out of luck on this front.

But if you live in a walk-up, brownstone, or other apartment with multiple entrances, get a little resourceful. See if you can find an unlocked window or if you can gain access by climbing up the fire escape. In short, break into your own home.

For Next Time: Find a Keyholder

When you get into your apartment (hallelujah!), it’s time to start preparing for the next time this happens. You don’t want to be stuck in this position again – locked out with no way in. So, consider making a spare key and finding someone you trust who can hold onto it for you.

This could be a best friend, a significant other, or a neighbor – just make sure you can trust implicitly that he or she won’t try to get into your apartment while you’re gone or lose your key altogether. Oh, and avoid putting your key under your doormat or on top of your door frame. That’s just asking for trouble.

Or, Keep a Spare Key on You

Another preventative measure? Making a spare key that you keep with you at all times. Put it in its own pocket in your purse or wallet, or keep it between your phone and phone case. That way, you’ll always have a way in.