Button acts on Multiple Selection in subdatasheet

  • Thread starter Thread starter Bradley C. Hammerstrom
  • Start date Start date
B

Bradley C. Hammerstrom

A2K,

Can I have a command button act on the records of a multiple selection in a
subdatasheet? If so how?

Brad H.
 
Ken,

The records in the subdatasheet contain a FilePath field and a FileName
field, and I want to copy the selected files to a directory. I can do this
already with a command button on the main form, but it copies all in the
current recordset. What I'm looking for is a way for the user to either
Filter By Selection or simply Ctrl+Click the desired record or records and
then click the command button to FileCopy only those files.

Brad H.
 
I am assuming that you "select" the records in some way? By a checkbox on
the records? Or are you wanting to filter the recordset and then just use
those records?

What is the code that is running for the button that you already have on the
form?
 
Ken,

(Since my last post I dicovered that I, in fact, cannot Ctl+Click to select
non-adjacent records in the subdatasheet, a la Excel.)

Yes, I have a checkbox field which the user can filter on but I want to be
able to filter on any other field as well.

The code in the button opens a custom dialog (a form, really) that; 1) has a
Browse button to let the user select a destination folder for the copied
files; 2) displays the list to be copied in a ListBox; and, 3) has the
command button that copys the list via FileCopy.

I realize that a preferred alternative would be to use MultiSelect in the
ListBox, but the filter on the other form will not work on the SQL behind
the ListBox because I'm using--drumroll--Lookup fields, so the SQL filter
looks something like, ((Lookup_Defect__ID.Defect = etc.)), which the SQL in
the ListBox doesn't recognize as a valid field.

So I'm trying to find a work-around. . .

Brad H.
 
Using the built-in "search/find" option of the form, as you've already
discovered, limits you to just one field at a time. To do multiple fields,
you must (as you have done already) use a search form that you build and
that lets you do the desired searching.

While lookup fields do complicate things, you can work around them to use a
multiselect listbox. Use of a multiselect listbox requires code for reading
which items were selected, so that code could "look up" the correct info
from the lisbox's selections. Or, you could change the SQL of the list box's
Row Source query to have the listbox actually contain both the displayed and
the real values, and then you could use the values from a column of the
listbox's selections.

If you could post info re: the list box's Row Source query's SQL statement,
the table structure that you have, and the code that you're running now, I
think we could suggest some ways to do what you want.
 
Back
Top