|
3#
楼主 |
发表于 2015-6-8 06:09:46
来自手机
|
只看该作者
With m_rs ' Open recordset .Source = "SELECT * FROM jobs" .LockType = adLockBatchOptimistic .CursorType = adOpenStatic .CursorLocation = adUseClient Set .ActiveConnection = m_conn .Open ' Disconnect recordset Set .ActiveConnection = Nothing End With ' "Give" recordset to the form ' so that user can move around and change some records. Set Me.Recordset = m_rs End Sub Private Sub cmdSave_Click() With m_rs ' Re-connect recordset Set .ActiveConnection = m_conn ' Save changes Call .UpdateBatch(adAffectAll) End With Me.SetFocus DoCmd.Close End Sub None of the changes made by the user are applied to the database. :-( Interestingly enough, when I inspect the form's recordset just before reconnecting it, all the records touched by the user through the form's controls do have new values in their fields. But, because of some reasons - reasons that I do not understand yet - those changes are not respected by UpdateBatch method (or by the adFilterPendingRecords filter). If connected-ness of ADO recordsets was meant to be transparent to Access 2003 forms (and I really want to believe so), then it feels like I am missing some small but important details here. Any help would be greatly appreciated! Thank you, Yarik. Re: Cannot update a disconnected (and then |
|