Hi,
I have a form with some unbounded textboxes and an Edit button.
When the Edit button is clicked, it should run a SQL query then retrieve a record from a table into the recordset then the record source of those unbounded textboxes set to the fields of the recordset.
Before I clicked the Edit button all the textboxes are editable. When I click the button all the textboxes show the correct data from the recordset but they become uneditable.
Here are the codes. Can anyone tell me what I have done wrong?
Option Compare Database
Option Explicit
Private rst As New ADODB.Recordset
Private Sub btnNew_Click()
Dim sSql As String
sSql = "select * from tblSO where ID=xxx"
rst.Open sSql, CurrentProject.Connection, adOpenKeyset, dLockOptimistic
Set Me.Recordset = rst
tbxID.ControlSource = rst.Fields.Item("ID").name
tbxDate.ControlSource = rst.Fields.Item("SODate").name
End Sub
I have a form with some unbounded textboxes and an Edit button.
When the Edit button is clicked, it should run a SQL query then retrieve a record from a table into the recordset then the record source of those unbounded textboxes set to the fields of the recordset.
Before I clicked the Edit button all the textboxes are editable. When I click the button all the textboxes show the correct data from the recordset but they become uneditable.
Here are the codes. Can anyone tell me what I have done wrong?
Option Compare Database
Option Explicit
Private rst As New ADODB.Recordset
Private Sub btnNew_Click()
Dim sSql As String
sSql = "select * from tblSO where ID=xxx"
rst.Open sSql, CurrentProject.Connection, adOpenKeyset, dLockOptimistic
Set Me.Recordset = rst
tbxID.ControlSource = rst.Fields.Item("ID").name
tbxDate.ControlSource = rst.Fields.Item("SODate").name
End Sub