When you enter public or privately held buildings they have the right to ask that firearms are not permitted. Metal detectors or guards may be posted to ensure the rule is upheld
When you enter someones property they have the right to ask that firearms not be permitted. You can ask someone to leave who has a firearm and if they don't call the police and report them as tresspassing.
When you enter a concert or sporting event they have the right to ask that firearms not be permitted and may actually search your person or require a metal detector to ensure that you are not carrying a weapon.
My guess is that this store has a rule that no firearms are to be brought onto their property and if a person is found to bring a firearm onto the property they are asked to leave. If they do not, I am sure the store calls the police and they are arrested for trespassing.
So if there were a law would that have prevented the incident. No it wouldn't. What is a law other than a rule enforced by law enforcement and the court system? You can see that a rule to keep guns didn't work, why would a rule endorsed by the legal system? Oh, and by the way, there are laws that are enforced for shooting people and especially killing them. That didn't stop this insane man anymore than banning guns would of stopped him. It wasn't the gun, it was the man.