This happens to me all the time. I’ll have a vivid recollection of what my dream was and then I realize I only have half an hour before I need to leave my apartment. Lately though I realize within the middle of my dream that I must be oversleeping then wake up very suddenly which makes me forget my dream almost instantly. Now if only I could turn this into lucid dreaming I’d be all set.