Aceman,
I've done it this way because I don't want changes that users make in the subform reflected in the source tables.
...maybe you know simpler way???
I have narrowed down the problem now. If I select a textbox on the subform I can make changes ok and all my records stay. Its only when I select a checkbox that my records disappear!
My code:-
1. M_ordersDue Module:-
Global RsSt10 As ADODB.Recordset
Sub SetGlobals()
Set RsSt10 = New ADODB.Recordset
With RsSt10
.Fields.Append "Buyer", adVarWChar, 20
.Fields.Append "OrdersPlaced", adInteger
.Fields.Append "Tick", adBoolean
.Fields.Append "CalcTemp", adInteger
End With
End Sub
2. On open event of main form:-
Dim FrmTempRs As Recordset
Dim Frm As Form
Dim ctl As Control
DoCmd.Maximize
SetGlobals
Set Frm = Forms("FrmViewWeeklyData")
Set ctl = Frm.Controls("FrmViewWeeklyDataBuyerAddData")
Set FrmTempRs = ctl.Form.RecordsetClone
If Not FrmTempRs.EOF Then FrmTempRs.MoveFirst
'then copy data from FrmTempRs to new temp recordset RsSt10
With M_ordersDue.RsSt10
M_ordersDue.RsSt10.Open , , adOpenKeyset, adLockOptimistic
Do Until FrmTempRs.EOF
.AddNew
.Fields("Buyer") = FrmTempRs.Fields("Buyer")
.Fields("OrdersPlaced") = FrmTempRs.Fields("OrdersPlaced")
.Fields("Tick") = FrmTempRs.Fields("Tick")
.Fields("CalcTemp") = FrmTempRs.Fields("CalcTemp")
.Update
FrmTempRs.MoveNext
Loop
End With
Set ctl.Form.Recordset = M_ordersDue.RsSt10
etc..etc....
Its the "Tick" field that's causing me grief!
After debugging, I find that the records are still there after entering subform, but they disppear before update of "tick" field.
Funny thing is, is that I have almost identical code running on another form/subform and it works fine!
Any clues?