Take a look at the DataBaseForm example here

http://www.excel-it.com/vba_examples.htm