Building forms with ADO connections makes them more flexible and user friendly. The forms are easy to operate and also work well with the database below.
Dim rs As ADODB.Recordset
ado1.Open "DSN=dsn1"
rs.Source = "Personal"
rs.ActiveConnection = ado1
rs.Open
rs.Fields("Address") = "" & Text2.Text
rs.Fields("Phone Number") = "" & Text3.Text
rs.Fields("Company Name") = "" & Text4.Text
rs.Update
Set rs = Nothing
Set cn = Nothing
Private Sub Command1_Click()
Dim ado1 As New ADODB.ConnectionDim rs As ADODB.Recordset
ado1.Open "DSN=dsn1"
Set rs = New ADODB.Recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimisticrs.Source = "Personal"
rs.ActiveConnection = ado1
rs.Open
rs.AddNew
rs.Fields("Name") = "" & Text1.Textrs.Fields("Address") = "" & Text2.Text
rs.Fields("Phone Number") = "" & Text3.Text
rs.Fields("Company Name") = "" & Text4.Text
rs.Update
rs.Close
ado1.CloseSet rs = Nothing
Set cn = Nothing