If this is Access 2000, that's a limitation of the Recordset property in
Access 2000, the form will always be read-only. In later versions of Access
the form can be read/write, but you must set the CursorLocation, CursorType
and LockType properties of the recordset - as always when opening an ADO
recordset, if you accept the default values for these properties you get a
read-only, forward-only recordset. Here's an example ...
Option Compare Database
Option Explicit
Dim mrst As ADODB.Recordset
Private Sub cmdLoad_Click()
Set mrst = New ADODB.Recordset
With mrst
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open CurrentProject.Path & "\test.xml", , , , adCmdFile
End With
Set Me.Recordset = mrst
End Sub
Private Sub cmdSave_Click()
mrst.Save
End Sub
Private Sub Form_Close()
If Not mrst Is Nothing Then
If mrst.State <> adStateClosed Then
mrst.Close
End If
End If
End Sub
--
Brendan Reynolds (MVP)
"PANCZO via AccessMonster.com" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> HI!
>
> I have a problem...
> I try to bind XML data to (unbound) form
> so, on Load:
>
> Dim rst As New ADODB.Recordset
> On Error Resume Next
> rst.Open "pathtomyxmlfile", "Provider=MSPersist;", , , adCmdFile
>
> If Err.Number = 0 Then
> Set me.recordset = rst
> End If
>
>
> And I see data on the form (I cut code with sets controlsource)
> , but I can't modyfy and add new records.
> Any solutions?
>
> --
> Message posted via http://www.accessmonster.com