Hopefully the title has not put most of you off, under my outlook form (with tab as page1), I have the following code under a commandbutton click event :

Dim DAO, DAO3, DB, RS
Set DAO = Application.CreateObject("DAO.DBEngine.35")
Set DAO3 = DAO.Workspaces(0)
Set DB = DAO3.OpenDatabase("c:\MydB.mdb")
Set RS = DB.OpenRecordset("Select * from Table1 _
Order by Name")

Dim TxtName
Set TxtName = Item.GetInspector.ModifiedFormPages _
("page1").Controls.Item("TxtName")

Rs.addnew
Rs.Name = txtName.text
Rs.Update


Now then, I have been using outlook forms for about 4 months, but this is the first time I have tried to access a database with one. I cannot write with ADO, and any samples of DAO with outlook I cannot get to work.

Could someone please tell me where/how the above code is wrong!?? The above uses a MS Access 97 database (named MydB.mdb) which has 1 table (table1 [I know, very imaginative!]) and this in turn has 1 column (called Name). Thank you.



Thank you everyone!
Alex Read