Reliable sequential activity of neurons in the entorhinal cortex is necessary to encode spatially guided behavior and memory. In a realistic computational model of a medial entorhinal cortex (MEC) microcircuit, with stellate cells coupled via a network of inhibitory interneurons, we show how intrinsic and network mechanisms interact with theta oscillations to generate reliable outputs. Sensory inputs activate interneurons near their most excitable phase during each theta cycle. As the inputs change, different groups of interneurons are recruited and postsynaptic stellate cells are released from inhibition causing a sequence of rebound spikes. Since the rebound time scale of stellate cells matches theta oscillations, its spikes get relegated to the least excitable phase of theta ensuring that the network encodes only the external drive and ignores recurrent excitation by rebound spikes. In the absence of theta, rebound spikes compete with external inputs and disrupt the sequence that follows.Our simulations concur with experimental data that show, subduing theta oscillations disrupts the spatial periodicity of grid cell receptive fields. Further, the same mechanism where theta modulates the gain of incoming inputs may be used to select between competing sources of input and create transient functionally connected networks. * collins@iiserpune.ac.in