Sort form datasheet attempt crashes Access 2003 (error 3450-Access
am 16.01.2008 18:09:41 von curran.george
'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
Re: Sort form datasheet attempt crashes Access 2003 (error 3450-Access 2007)
am 16.01.2008 23:34:45 von Lyle Fairfield
curran.george@gmail.com wrote in news:36a9ad3f-5474-4995-b8e1-
9ec05b948e56@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.
Re: Sort form datasheet attempt crashes Access 2003 (error
am 17.01.2008 19:56:33 von curran.george
On Jan 16, 5:34=A0pm, lyle fairfield wrote:
> curran.geo...@gmail.com wrote in news:36a9ad3f-5474-4995-b8e1-
> 9ec05b948...@i29g2000prf.googlegroups.com:
>
>
> Hi Lyle,
Thank you for your suggestion and demonstration of adding a button and
code to sort the recordset on the button click event. we may have to
go this route with our 16-column datasheet - which would require the
ability to sort by any column. I guess we would need to remove the
default/standard Access menus/toolbars and specify a custom menu at
startup with no record sort option. Maybe there is still another way
around this... thanks again!
>
>
> > 'add one textbox to form1 with Control Source property =3D 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
> > =A0 =A0 Dim rsx As ADODB.Recordset
> > =A0 =A0 Set rsx =3D New ADODB.Recordset
> > =A0 =A0 rsx.CursorLocation =3D adUseClient
> > =A0 =A0 rsx.CursorType =3D adOpenDynamic
> > =A0 =A0 rsx.LockType =3D adLockOptimistic
>
> > =A0 =A0 rsx.Fields.Append "ID", adDouble
>
> > =A0 =A0 rsx.Open
>
> > =A0 =A0 rsx.AddNew 0, 1
> > =A0 =A0 rsx.Update
>
> > =A0 =A0 rsx.AddNew 0, 2
> > =A0 =A0 rsx.Update
>
> > =A0 =A0 rsx.AddNew 0, 3
> > =A0 =A0 rsx.Update
>
> > =A0 =A0 Set Form_Form1.Recordset =3D 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()
> =A0 =A0 rsx.Sort =3D "ID Desc"
> =A0 =A0 Set Me.Recordset =3D rsx
> End Sub
>
> Private Sub Form_Load()
>
> =A0 =A0 Set rsx =3D New ADODB.Recordset
> =A0 =A0 With rsx
> =A0 =A0 =A0 =A0 .CursorLocation =3D adUseClient
> =A0 =A0 =A0 =A0 .CursorType =3D adOpenStatic
> =A0 =A0 =A0 =A0 .LockType =3D adLockBatchOptimistic
>
> =A0 =A0 =A0 =A0 .Fields.Append "ID", adInteger
>
> =A0 =A0 =A0 =A0 .Open
>
> =A0 =A0 =A0 =A0 .AddNew 0, 1
> =A0 =A0 =A0 =A0 .AddNew 0, 2
> =A0 =A0 =A0 =A0 .AddNew 0, 3
>
> =A0 =A0 =A0 =A0 .UpdateBatch
>
> =A0 =A0 =A0 =A0 .MoveFirst
> =A0 =A0 End With
>
> =A0 =A0 Set Me.Recordset =3D 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.- Hide quoted text -
>
> - Show quoted text -