I'm using Access2002, and can't seem to get an updateable recordset going
:-(
What am I doing wrong, here's the code. The form's controls are not locked,
the recordset type is Dynaset (changing to Dynaset inconsistent updates does
not work), I'm allowing edits, and I'm at a loss ...
Please help!
Option Compare Database
Public rstMember As New Recordset
Public cntConn1 As New Connection
Public cmd As New Command
Private Sub Form_Close()
rstMember.Close
cntConn1.Close
Set rstMember = Nothing
Set cntConn1 = Nothing
Set cmd = Nothing
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim cntl As Control
Dim fld As Field
'Specify the connect string
cntConn1.Connec tionString = "DSN=test;uid=a dmin;pwd="
'Open the connection
cntConn1.Open
'Specify the SQL statement
cmd.ActiveConne ction = cntConn1
cmd.CommandText = "SELECT LName FROM tblMemberInfo"
'Open the recordset
rstMember.Curso rLocation = adUseClient
rstMember.Open cmd, , adOpenStatic, adLockBatchOpti mistic, adCmdText
Me.UniqueTable = "tblMemberI nfo"
Set Me.Recordset = rstMember
For Each fld In rstMember.Field s
For Each cntl In Me.Controls
If cntl.Name = fld.Name Then
cntl.ControlSou rce = fld.Name
End If
Next
Next
End Sub
:-(
What am I doing wrong, here's the code. The form's controls are not locked,
the recordset type is Dynaset (changing to Dynaset inconsistent updates does
not work), I'm allowing edits, and I'm at a loss ...
Please help!
Option Compare Database
Public rstMember As New Recordset
Public cntConn1 As New Connection
Public cmd As New Command
Private Sub Form_Close()
rstMember.Close
cntConn1.Close
Set rstMember = Nothing
Set cntConn1 = Nothing
Set cmd = Nothing
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim cntl As Control
Dim fld As Field
'Specify the connect string
cntConn1.Connec tionString = "DSN=test;uid=a dmin;pwd="
'Open the connection
cntConn1.Open
'Specify the SQL statement
cmd.ActiveConne ction = cntConn1
cmd.CommandText = "SELECT LName FROM tblMemberInfo"
'Open the recordset
rstMember.Curso rLocation = adUseClient
rstMember.Open cmd, , adOpenStatic, adLockBatchOpti mistic, adCmdText
Me.UniqueTable = "tblMemberI nfo"
Set Me.Recordset = rstMember
For Each fld In rstMember.Field s
For Each cntl In Me.Controls
If cntl.Name = fld.Name Then
cntl.ControlSou rce = fld.Name
End If
Next
Next
End Sub
Comment