I recently hit the bottom of my bag of hamster food and ran to the store to get another bag. After searching the shelves I learned that they may not carry the kind I previously used, and because I had no food I bought a different kind. Will this have negative effects on my hamster? I am concerned because I had a friend switch hamster foods and shortly after her hamster passed away.
It is always best when switching food to do it gradually. My answer at Do I need to do anything special when I change what I feed my rabbit? goes into detail about changing rabbit food.
At this point you don't really have a choice, but to change. Hopefully you have been feeding hay and.or greens (i.e. lettuce) regularly and continuing this will allow you to keep some consistency in the diet.
If possible, change to a new food that closely resembles the old food. If you still have the empty bag of old food, take it with you to compare ingredients.
In any case, feed the same total amount of hamster food. (assuming similar replacement, you made need to adjust quantity if there is a drastic change in quality)
Watch the hamster for changes in eating or pooping, and if significant take them to the vet.