By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

Do datasheets support multiple selections?

P: n/a
How do I get the items selected from a datasheet? Does a datasheet support
multiple selections?

I know a ListBox has a "Selected" property that can be used when the
MultiSelect property is set - but is there a way to get the same
functionality with a datasheet?

If not, I'm throwing all my datasheets in the junk..... why bother with
datasheets? get all the same functionality with a listbox?

For example, with a ListBox, it might look something like this;

Dim varItem As Variant

Dim ctl As Control

Set ctl = frmMain!lstNames

For Each varItm In ctl.ItemsSelected

Debug.Print ctl.ItemData(varItm)

Next varItm

With a datasheet:

Dim ctl As Control
Set ctl = Forms!frmMain!frmInventory
For Each varItem In ctl.ItemData(varItem)
Debug.Print varItem
Next

does not work
Dim frm As Form
Set frm = Forms!frmMain!frmInventory.Form
For Each varItem in frm.?????
Debug.Print varItem
Next
Nov 12 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
You can select contiguous rows in a datasheet.

Use the SelTop and SelHeight properties to get information about the
selected rows programmatically.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"deko" <dj****@hotmail.com> wrote in message
news:G_*****************@newssvr25.news.prodigy.co m...
How do I get the items selected from a datasheet? Does a datasheet support multiple selections?

I know a ListBox has a "Selected" property that can be used when the
MultiSelect property is set - but is there a way to get the same
functionality with a datasheet?

If not, I'm throwing all my datasheets in the junk..... why bother with
datasheets? get all the same functionality with a listbox?

For example, with a ListBox, it might look something like this;

Dim varItem As Variant

Dim ctl As Control

Set ctl = frmMain!lstNames

For Each varItm In ctl.ItemsSelected

Debug.Print ctl.ItemData(varItm)

Next varItm

With a datasheet:

Dim ctl As Control
Set ctl = Forms!frmMain!frmInventory
For Each varItem In ctl.ItemData(varItem)
Debug.Print varItem
Next

does not work
Dim frm As Form
Set frm = Forms!frmMain!frmInventory.Form
For Each varItem in frm.?????
Debug.Print varItem
Next

Nov 12 '05 #2

P: n/a
You can access the rowindex by checking the SelTop and SelHeight properties
of the form to determine the starting row number, and the number of rows
selected.

Mike Storr
www.veraccess.com
"deko" <dj****@hotmail.com> wrote in message
news:G_*****************@newssvr25.news.prodigy.co m...
How do I get the items selected from a datasheet? Does a datasheet support multiple selections?

I know a ListBox has a "Selected" property that can be used when the
MultiSelect property is set - but is there a way to get the same
functionality with a datasheet?

If not, I'm throwing all my datasheets in the junk..... why bother with
datasheets? get all the same functionality with a listbox?

For example, with a ListBox, it might look something like this;

Dim varItem As Variant

Dim ctl As Control

Set ctl = frmMain!lstNames

For Each varItm In ctl.ItemsSelected

Debug.Print ctl.ItemData(varItm)

Next varItm

With a datasheet:

Dim ctl As Control
Set ctl = Forms!frmMain!frmInventory
For Each varItem In ctl.ItemData(varItem)
Debug.Print varItem
Next

does not work
Dim frm As Form
Set frm = Forms!frmMain!frmInventory.Form
For Each varItem in frm.?????
Debug.Print varItem
Next

Nov 12 '05 #3

P: n/a
> You can select contiguous rows in a datasheet.

Thanks... but I'll have to admit - I'm beginning to like list boxes more...
Nov 12 '05 #4

P: n/a
By all means use a list box if you only need to display a few rows (not 10s
of thousands), and you do not need to edit the columns.

They use fewer resources than subforms do.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"deko" <dj****@hotmail.com> wrote in message
news:jR***************@newssvr29.news.prodigy.com. ..
You can select contiguous rows in a datasheet.


Thanks... but I'll have to admit - I'm beginning to like list boxes

more...
Nov 12 '05 #5

P: n/a
> By all means use a list box if you only need to display a few rows (not
10s
of thousands), and you do not need to edit the columns


Yes, I suppose that is one big advantage of a datasheet - in-cell editing;
also, filtering. Is there a best-practices limit of how may records should
be retreived with a listbox? several hundred? one thousand? By the way, I
think the standard DataGrid in VB does support multiple selection, unlike
the Access datasheet.

Nov 12 '05 #6

P: n/a
While I have the opportunity to rant about the limitations of datasheets,
let's not forget how difficult it is to work with column widths - for
example, let's say I have a subform datasheet that I want to keep a certian
size (height and width) on the main form - a vertical scrollbar appears as
the number of records exceeds the available height. The problem is that
this results in the unwelcome appearance of a horizontal scrollbar (even if
the scrollbars property is set to vertical only) if the vertical scrollbar
overlaps any text (in any of the existing rows) when it appears. Column
widths are also a pain to set programatically.

I feel better now....
Nov 12 '05 #7

P: n/a
"deko" <dj****@hotmail.com> wrote in
news:oZ******************@newssvr27.news.prodigy.c om:
Yes, I suppose that is one big advantage of a datasheet - in-cell
editing; also, filtering.


I never knew that! Wow!

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #8

P: n/a
Deko, have you tried Continuous Form view instead of Datasheet?

Users cannot get stuck hiding columns etc.
Form header and footer sections are displayed, and can have command buttons.

Glad you feel better after the rant. :-)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"deko" <dj****@hotmail.com> wrote in message
news:T9******************@newssvr27.news.prodigy.c om...
While I have the opportunity to rant about the limitations of datasheets,
let's not forget how difficult it is to work with column widths - for
example, let's say I have a subform datasheet that I want to keep a certian size (height and width) on the main form - a vertical scrollbar appears as
the number of records exceeds the available height. The problem is that
this results in the unwelcome appearance of a horizontal scrollbar (even if the scrollbars property is set to vertical only) if the vertical scrollbar
overlaps any text (in any of the existing rows) when it appears. Column
widths are also a pain to set programatically.

I feel better now....

Nov 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.