I have a query that by nature is read-only. This data is used to populate a form in datasheet mode.
Somehow I need to be able to edit the entry and update the source table. Any Ideas.
I appreciate the fact that I will need vba code to do the updating. that is no problem.
I have tried to create a disconnected recordset and clone a recordset they all come out readonly.
The main thing is to be able to able to change the entry.
I have also considered using the readonly form as a subform and use the onclick event to update text boxes on the parent form. this will work but it is not the solution I was hoping for
Regards Phill
ps my current code :
Private Sub Form_Open(Cancel As Integer)
'On Error Resume Next
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim query As String
Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & CurrentDb.Name
If err <> 0 Then
MsgBox "A connection error has occured." & vbNewLine & err.Description, vbCritical
err = 0
Exit Sub
End If
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
rst.Properties
query = "SELECT Item_Query.PHANDLE, Item_Query.TEXTSTRING AS ITEM, Descr_Query.TEXTSTRING AS DESCR " & _
"FROM Item_Query INNER JOIN Descr_Query ON Item_Query.PHANDLE=Descr_Query.PHANDLE;"
rst.Open query, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Set Me.Recordset = rst
End Sub

Somehow I need to be able to edit the entry and update the source table. Any Ideas.
I appreciate the fact that I will need vba code to do the updating. that is no problem.
I have tried to create a disconnected recordset and clone a recordset they all come out readonly.
The main thing is to be able to able to change the entry.
I have also considered using the readonly form as a subform and use the onclick event to update text boxes on the parent form. this will work but it is not the solution I was hoping for
Regards Phill
ps my current code :
Private Sub Form_Open(Cancel As Integer)
'On Error Resume Next
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim query As String
Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & CurrentDb.Name
If err <> 0 Then
MsgBox "A connection error has occured." & vbNewLine & err.Description, vbCritical
err = 0
Exit Sub
End If
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
rst.Properties
query = "SELECT Item_Query.PHANDLE, Item_Query.TEXTSTRING AS ITEM, Descr_Query.TEXTSTRING AS DESCR " & _
"FROM Item_Query INNER JOIN Descr_Query ON Item_Query.PHANDLE=Descr_Query.PHANDLE;"
rst.Open query, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Set Me.Recordset = rst
End Sub
