I've spent hours on this and I'm perplexed as I've tried everything, yet I can't make edits with ADODB recordset bound to my form.
Access 2010 linking to SQL Server 2008.
Simple form bound to a single table.
Connection string works fine.
Code is as below (cursor etc is set using enums btw). Does anyone have any suggestions?
Many thanks
Access 2010 linking to SQL Server 2008.
Simple form bound to a single table.
Connection string works fine.
Code is as below (cursor etc is set using enums btw). Does anyone have any suggestions?
Many thanks
Code:
Private Sub Form_Open(Cancel As Integer)
Dim rst As ADODB.Recordset
If g1OpenRecordset(rst, "tblName", rrOpenKeyset, rrLockOptimistic, False) = False Then
Cancel = True
Exit Sub
End If
Set Me.Recordset = rst
Set rst = Nothing
End Sub
Public Function g1OpenRecordset(ByRef rs As ADODB.Recordset, strSQL As String, Optional rrCursor As rrCursorType, _
Optional rrLock As rrLockType, Optional blnClientSide As Boolean) As Boolean
If g1Con.State = adStateClosed Then
g1Con.ConnectionString = g1ConnectionStr
g1Con.Open
End If
Set rs = New ADODB.Recordset
With rs
.ActiveConnection = g1Con
If blnClientSide Then
.CursorLocation = adUseClient
Else
.CursorLocation = adUseServer
End If
.CursorType = IIf((rrCursor = 0), adOpenStatic, rrCursor)
.LockType = IIf((rrLock = 0), adLockReadOnly, rrLock)
.Open strSQL
If .EOF And .BOF Then Exit Function
End With
g1OpenRecordset = True
End Function
Public Function g1ConnectionStr() As String
g1ConnectionStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ASAM;Data Source=ra_xpp_d37\dev"
'"Provider=OLEDB;Data Source=RA_XPP_D37\DEV;Database=ASAM;Trusted_Connection=yes"
End Function