Check the openform code (button click code).
For datasheet, it would look something like this:
[tt]docmd.openform "someform", acFormDS[/tt]
Check the different formviews of the openform method. Datasheet is acFormDS,
There are also properties of the form, where you can set the allowed views of the form (they differ a bit between xp and 2000, I think, but in xp you can set "allow form view", "allow datasheet view"...
Roy-Vidar