Probing the Role of Magnetic-Field Variations in NOAA AR 8038 in Producing a Solar Flare and CME on 12 May 1997