Bind a Form to a Recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Thanks for your help. The second article you referenced indicated that I
needed to set the CursorLocation = adUseClient. I can now edit.

Thanks,
 
Back
Top