Hello everyone,
Ive got a recordset and a [subform on a main form]. They both have the same fields, field names, field types. The idea is to bind the recordset to the subform so that it will display the data. Whats more, once the recordset binds itself to the subform, the user should be able to manipulate the subform and consequently, the underlying recordset. Thats what I want my bind to do.
Thing is, I get the impression that binding is a one off thing, once you bind it, the subform gets the data from the recordset, but changing the subform doesnt change the recordset. Kinda like when you make a = b, a becomes b, but b isnt changing, nor is it bound to a in any way.
I have a dirty solution to this, I have 2 buttons, download and upload. Download grabs the recordset and stuffs it into the subform. User edits subform, then when they hit upload, the subform.recordset is thrown into a recordset (the same one maybe)
Here is the (relevant) code:
Now this stuff is great, I get what I want, the subform shows all the records and everything. Then I fiddle around with the form, change the values etc...
Then:
Here, the same recordset name is used, and the subform data is placed into a recordset.
So the queston is, is there a better way of doing this, without buttons? Just bind it and have it bound... so that any changes of the subform data changes the recordset immediately? Or am I deeply mistaken in thinking binding is a one off thing?
OS: Vista Home Premium
Version: Access 2007
File Type: Microsoft Access 2000 compatible version
References: Microsoft ActiveX Data Objects 2.0 Library
Ive got a recordset and a [subform on a main form]. They both have the same fields, field names, field types. The idea is to bind the recordset to the subform so that it will display the data. Whats more, once the recordset binds itself to the subform, the user should be able to manipulate the subform and consequently, the underlying recordset. Thats what I want my bind to do.
Thing is, I get the impression that binding is a one off thing, once you bind it, the subform gets the data from the recordset, but changing the subform doesnt change the recordset. Kinda like when you make a = b, a becomes b, but b isnt changing, nor is it bound to a in any way.
I have a dirty solution to this, I have 2 buttons, download and upload. Download grabs the recordset and stuffs it into the subform. User edits subform, then when they hit upload, the subform.recordset is thrown into a recordset (the same one maybe)
Here is the (relevant) code:
Code:
Public Sub rstToForm_Click()
Dim lateAbsentFrs As New ADODB.Recordset
With lateAbsentFrs
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
End With
<Recordset fields appended and populated>
Set Forms![frm_classes]![frm_LateAbsentDisplay].Form.Recordset = lateAbsentFrs
<Stuff that destroys the recordset, sets it to nothing, closes it etc...>
End Sub
Now this stuff is great, I get what I want, the subform shows all the records and everything. Then I fiddle around with the form, change the values etc...
Then:
Code:
Private Sub reIterate_Click()
'Dim lateAbsentFrs As New Recordset
'Set lateAbsentFrs = Forms![frm_classes]![frm_LateAbsentDisplay].Form.Recordset
For Each Field In lateAbsentFrs.Fields
MsgBox (Field.Value)
Next
End Sub
Here, the same recordset name is used, and the subform data is placed into a recordset.
So the queston is, is there a better way of doing this, without buttons? Just bind it and have it bound... so that any changes of the subform data changes the recordset immediately? Or am I deeply mistaken in thinking binding is a one off thing?
OS: Vista Home Premium
Version: Access 2007
File Type: Microsoft Access 2000 compatible version
References: Microsoft ActiveX Data Objects 2.0 Library