Cannot update ADO recordset from form

M

Michael Kellogg

I made some changes to my A2000 app that included changing the underlying
recordset to explicitly be an ADO recordset object. I'm still confused
as to whether this was the case by default already, before, or not.

Now, all of a sudden my form won't allow me to edit the data. The
recordset itself is updatable, as I can make changes to it in the
Immediate window, directly, and those changes take in the database and
get updated in the form no problem. However, if I try to change any text
box values (text boxes that are connected to the recordset), the status
bar says the form is read-only and I get a 2448 error, "You can't assign
a value to this object."

Here is my setup code:
Set mAdoRst = New ADODB.Recordset
With mAdoRst
Set .ActiveConnection = mAdoCn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.CursorLocation = adUseServer
.Open "Clocks"
.Filter = "empID = 1"
End With
Set Me.Recordset = mAdoRst

I had tried, originally, a long SELECT statement with a join and a WHERE,
but when I couldn't edit I thought that might be the problem. I still
can't get it to take. Any thoughts?
 
M

Michael Kellogg

FYI, I never did figure out why the form was not updateable while the
underlying recordset WAS. What I wound up doing was unbinding all the
textboxes that needed to be updateable, then updating them
programmatically; changing the recordset values at LostFocus, and filling
in the textboxes whenever the form refreshes. I like the added control
and the ADO, which I'm more familiar with than DAO, even though this
overall seems a little kludgy. Is there anything wrong with my approach?

-mk
 

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