You cannot completely prevent bugs from coming into your apartment or going anywhere for that matter.  You can, though, help to reduce their desire to come into your apartment. There are many conditions that attract bugs of all types. Some very common attractors include dirty dishes in the kitchen sink, spilled food on the stove/range top and in eyelets, dropped food, food wrappers, spilled beverages of all types and any kind of garbage. Everyone can help with the insect problem by keeping your apartments, and therefore your apartment building, as clean as possible and taking out your trash regularly.