Take as look at the database form example here

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