I believe your car is choking. Chocking is the act of placing wooden blocks in front of, and behind the wheels.
Did replacing the fuel filter help?
Yes, do report your codes.
Ed in San Jose '97 540i 6 speed aspensilber over aubergine leather. Build date 3/97. Golden Gate Chapter BMW CCA Nr 62319.