Bind a Form to a Recordset

P

prototype

I am trying to bind a form to a record set using access 2003. However, I can
not edit the data in the form. I made sure that the record locks are set
correctly. Does anyone know how to bind a recordset to a form and allow the
records to be edited (i.e. not read only)? I used the following code:

Note: the "frm" and "rst" ojects are defined as public variables in a module.

Private Sub btn_Click()
Set frm = New Form_TestForm
Set rst = New ADODB.Recordset
rst.Open "testTable", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
Set frm.Recordset = rst
frm.Visible = True
End Sub
 
K

Ken Snell \(MVP\)

See this article; it states that a form bound to an ADO recordset is
read-only for ACCESS 2000, meaning you cannot edit the data in that form:
http://support.microsoft.com/kb/227053/EN-US/


This article gives info about how to bind a form to ADO recordset and be
able to edit the data, if you use ACCESS 2002 or later version:
http://support.microsoft.com/kb/281998/EN-US/


As Karl says elsethread, you most likely can just bind the form to a table
or query and not need to use ADO recordset. Or, if you want to bind to a
recordset, use a DAO recordset instead -- just remember to not close that
recordset while the form is open, else the form will not be bound any more.
 
P

prototype

Thanks for your help. The second article you referenced indicated that I
needed to set the CursorLocation = adUseClient. I can now edit.

Thanks,
 

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