Subform datasheet selection

Subform datasheet selection

am 13.04.2005 14:58:01 von Pete Verhooven

Is there a way to perform actions on the selected records of a
datasheet subform? Actually I know it can be done from a pulldown menu
or a toolbar. But how can you create a button on the form that will do
the same thing? My problem is that every time you select something on
the datasheet when you click a button or any control you will lose the
selection. Is there anyway to prevent that? I'd rather create a
button than try to manage toolbar menus. Any help would be
appreciated. Here is the code that works with menu toolbar:

Public Function t1()
Dim i As Long
Dim strSQL As String
Dim loqd As QueryDef

vbSelectHeight =
Forms!wlef_WorkList_Edit!wlef_WorkList_Edit_Sub.Form.SelHeig ht

If Forms!wlef_WorkList_Edit!wlef_WorkList_Edit_Sub.Form.SelHeig ht = 0
Then
Exit Function
End if

With
Forms!wlef_WorkList_Edit!wlef_WorkList_Edit_Sub.Form.Records etClone
.MoveFirst
.Move
Forms!wlef_WorkList_Edit!wlef_WorkList_Edit_Sub.Form.SelTop - 1
For i = 1 To vbSelectHeight
MsgBox DocNo 'do something for each selected record
.MoveNext
Next i
End With
End Function

Re: Subform datasheet selection

am 14.04.2005 23:39:02 von Malcolm Cook

>Is there anyway to prevent that?

I dont think so.

You're now instead in the business of giving every control on your datasheet
a event proc to trap SelHeight, etc into globals whenever they are exited.

I'd go with spending time managing the toolbars.

My 2 cent.