If I configure one switch with all access ports in VLAN 10 and connect it to a switch with all access ports in VLAN 20, a host on the first switch will be able to communicate with a host on the second switch if both hosts are in the same subnet. However, if I have one switch with two hosts connected to it in the same subnet but on different VLANs, they are unable to communicate. Could anyone explain how this works to me? Thanks!
The key is probably how you are connecting the switches - sounds like NOT a trunk that preserves VLAN10 and VLAN20. With more detail from you, more detail might be possible, but that would seem to be the likely cause.
A trunk port adds a header that identifies the VLAN to all but the Native VLAN. An access port strips the header off. As traffic passes the access port, it assumes the VLAN based on what was assigned locally.