cu***********@gmail.com wrote in news:36a9ad3f-5474-4995-b8e1-
9e**********@i29g2000prf.googlegroups.com:
'add one textbox to form1 with Control Source property = ID
'copy/paste the form_load code below:
'Then open the form and then attempt to sort the datasheet
'crashes 2003, error 3450 Access 2007 - I can't find much info on
this... - Can someone explain what's happening and how to fix this?
Private Sub Form_Load()
'2008-01-11
Dim rsx As ADODB.Recordset
Set rsx = New ADODB.Recordset
rsx.CursorLocation = adUseClient
rsx.CursorType = adOpenDynamic
rsx.LockType = adLockOptimistic
rsx.Fields.Append "ID", adDouble
rsx.Open
rsx.AddNew 0, 1
rsx.Update
rsx.AddNew 0, 2
rsx.Update
rsx.AddNew 0, 3
rsx.Update
Set Form_Form1.Recordset = rsx
End Sub
I think that when one uses a virtual recordset as a form's recordset,
Access does not know what to sort.
I took liberties with your code as follows.
Dim rsx As ADODB.Recordset
Private Sub CmdSortDescending_Click()
rsx.Sort = "ID Desc"
Set Me.Recordset = rsx
End Sub
Private Sub Form_Load()
Set rsx = New ADODB.Recordset
With rsx
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
.Fields.Append "ID", adInteger
.Open
.AddNew 0, 1
.AddNew 0, 2
.AddNew 0, 3
.UpdateBatch
.MoveFirst
End With
Set Me.Recordset = rsx
End Sub
You will note that I created a command button (in the form footer) to
effect a sort.
It all worked swimmingly in Access 2007.