add record using unbound form

  • Thread starter Thread starter tim johnson
  • Start date Start date
T

tim johnson

I am using an unbound to add new record to tblCustomer
below.

The procedure below is attached to the click event of a
cmdButton but on clicking nothing happens.
What am I doing wrong? The relevant library ActiveX 2.7
ADO library is present


Set rst = New ADODB.Recordset
Set cnn = CurrentProject.Connection
rst.Open "tblCustomer", cnn, adOpenKeyset,
adLockOptimistic, adCmdTable

With rst
.AddNew
.Fields("Zip") = Me.Zip
.Fields("CurDate") = Me.CurDate
.Fields("Salutation") = Me.Salutation
.Fields("FirstName") = Me.FirstName
.Fields("LastName") = Me.LastName
.Fields("Street") = Me.Street
.Fields("City") = Me.City
.Fields("State") = Me.State
.Fields("Comments") = Me.Comments
.Update
End With


Thanks
 
What do you mean, "nothing happens"?
- the Click event doesn't fire?
- it fires, but the new record doesn't appear in the table?
- it appears in the table, but not on the form?

Do some debugging! Work out which of the above it is, & then post back.

HTH,
TC
 
Back
Top