S
sofakingfree
I posted this in another forum but I thought it would be more
appropriate asked here:
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.SelHeight
If Forms!wlef_WorkList_Edit!wlef_WorkList_Edit_Sub.Form.SelHeight = 0
Then
Exit Function
End if
With
Forms!wlef_WorkList_Edit!wlef_WorkList_Edit_Sub.Form.RecordsetClone
.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
appropriate asked here:
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.SelHeight
If Forms!wlef_WorkList_Edit!wlef_WorkList_Edit_Sub.Form.SelHeight = 0
Then
Exit Function
End if
With
Forms!wlef_WorkList_Edit!wlef_WorkList_Edit_Sub.Form.RecordsetClone
.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