Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: ADO recordset is not updatable on form


Message #1 by "Michael Mitchell" <michael@m...> on Tue, 25 Feb 2003 22:33:07
I have an Access 2000 form that is designed to be continuous and I use an 
SQL recordset as the forms Recordset, but it won't let me edit anything.  
What am I doing wrong?


*********Code from On Load***********************

Private Sub Form_Load()
On Error GoTo Err_Command2_Click

'=====================
'Open a connection without using a Data Source Name (DSN)

Dim cnADOConnectionObject As ADODB.Connection
Set cnADOConnectionObject = New ADODB.Connection

cnADOConnectionObject.ConnectionString = gMyServer
cnADOConnectionObject.Open

'=====================
Dim strSQL As String
Dim MyValue As String
Set RS = New ADODB.Recordset
MyValue = "B5001001"

strSQL = "SELECT [T_ElementDetail].* " & _
"FROM [T_ElementDetail] " & _
"WHERE ([T_ElementDetail].ELEMENT_NO LIKE " & "'" & MyValue & "') " & _
"ORDER BY [T_ElementDetail].ELEMENT_NO,[T_ElementDetail].LineNumber"

    With RS
        .CursorLocation = adUseClient
        .LockType = adLockOptimistic
        .CursorType = adOpenStatic
        Set .ActiveConnection = cnADOConnectionObject
        .Open strSQL        
'***
    End With
    
    Set Me.Recordset = RS
    
'Clean up
       Set RS = Nothing
        
       Set cnADOConnectionObject = Nothing


Exit Sub

Exit_Command2_Click:
    Exit Sub

Err_Command2_Click:
    MsgBox Err.Description

 Set RS = Nothing
    Resume Exit_Command2_Click

End Sub
***************End Code********************

  Return to Index