Re: How do I use a list box to update a record in a table



On Tue, 16 Aug 2005 13:07:03 -0700, "j1eggert"
<j1eggert@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>I have just started to learn how to program, so I am very limited in this
>area.
>
>I have created a form bound to a query. I have created a list box with
>specific columns from the query. The first column is bound. The list box
>automatically lists specific records based on criteria setup in the query. I
>have two fields for each record that need to be updated, which is done
>through text boxes. The requirement is to use the text boxes to enter the
>information into the rows, update the information in the table using command
>buttons, and after it is updated to automatically delete the row and move to
>the next row, and so-on, until they are all updated. If anyone has the time
>to assist me with this complex requirement it would be most appreciated.
>
>Thanks for your help!
>JEggert

While a Listbox could be programmed to do this - with some difficulty
- that is NOT a typical manner of using a listbox!

Ordinarily, a Listbox is used to select one row from a query - the
listbox's RowSource property, usually a query, sometimes a table; and
to store one field from that record into the Listbox's "Bound Column".
It would be unusual to base a Listbox on the same query as the Form
upon which you find the listbox.

Similarly, you're going the long way around by using VBA code (or
macros) in command buttons to update a table. Have you intentionally
*chosen* to do it this difficult way, instead of the much simpler
method of using a bound Form?

Finally, it *SOUNDS* like you want to update a row in your Table with
new data, and then delete the freshly updated row. Obviously this is
not your intent (it would be rather futile!) but I guess I don't
understand what your intent IS.

I'm *guessing* that you might have better luck by using a Subform (or
even a main form) which displays only those records which have not yet
been updated. Upon updating (using some criteria which I'm not sure
that I understand) the record would be saved to the table, but would
no longer be displayed on the (sub)Form, so only those records which
need updating would be visible to the user. Is this an accurate
summary of the desired goal?

John W. Vinson[MVP]
.