By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,500 Members | 830 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,500 IT Pros & Developers. It's quick & easy.

Field is based on an expression that can't be edited

P: n/a
I am using Access2002

I have the following code run when a form opens, and the form won't let me
edit the recordset.

The form and the controls are not locked, edit is allowed, Recordset Type is

Any thoughts?
Private Sub Form_Load()
Dim frm As New Form
Dim test As Boolean
Set frm = Me
test = SQLFunctions.BindForm(frm, "DSN=test;uid=admin;pwd=", _
"SELECT LName FROM tblMemberInfo")
Set frm = Nothing
End Sub
Function BindForm(frm As Form, cnConn As String, cmdtext As String) As
Dim rstMember As New Recordset
Dim Found As Boolean
Dim i As Integer
Dim cntConn1 As New Connection
Dim cmd As New Command
Dim cntl As Control
Dim fld As Field
'Specify the connect string
cntConn1.ConnectionString = cnConn
'Open the connection

'Specify the SQL statement
cmd.ActiveConnection = cntConn1
cmd.CommandText = cmdtext
'Open the recordset
rstMember.CursorLocation = adUseClient
rstMember.Open cmd, , adOpenStatic, , adCmdText

'set the form's recordset to the returned recordset

Set frm.Recordset = rstMember

'Bind the returned fields to the controls having the same
'name as the field
For Each fld In rstMember.Fields
For Each cntl In frm.Controls
If cntl.Name = fld.Name Then
cntl.ControlSource = fld.Name
End If

'close and destroy the objects used for querying


Set rstMember = Nothing
Set cntConn1 = Nothing
Set cmd = Nothing
GetRecords = True

End Function
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.