Many conditions that affect your memory can also cause depression or anxiety.
For some people, these mental health symptoms develop because of the affect that your condition has on your life - you may feel depressed or anxious about what is happening or will happen. In this case, treatments like therapy or certain medications (if otherwise safe for you) may help.
For other people, symptoms like anxiety and depression are actually caused by the same condition that causes their memory loss. In these cases, anxiety and depression are symptoms of your memory disorder, not reactions to your circumstances, so treating your condition will help ease your depression and anxiety.