add record using unbound form

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
 
T

TC

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top