Correct. There is no county that is an independent nation-state in the US. State officials and officers can enter and authorize entry to county buildings for legitimate law enforcement activities. To say otherwise would mean that county officials and buildings would be exempt from State Police jurisdiction. It's partly based on the Dillon Rule and has been the law of land since 1868. The sheriff might believe that it is "his" building, but that belief is mistaken. Not every state official has the authority to grant access to county buildings. However, there are people at the state level who can do this.