update multiple fields on table through a form

  • Thread starter Thread starter William
  • Start date Start date
W

William

I need some direction on how to handle updating a table from a form using
code.
I have a list box on my form containing auto number values (1-40) listed
from the ID Field table
I also have a text box on the form bound to an attribute field on the same
table that the user will enter a value that will define a group multiple
selected values from the list box.

For example:
ID # 1,3,5,9 will all be assigned an attribute of "Group I"
and
ID # 2,12,36 will all be assigned an attribute of "Group II"

How can I update the attribute fields for each selected ID on the table
based on what is entered in the text box field?

Thanks in advance,

William
 
Hi,



Issue an individual update statement for each record:

Me.Dirty = False ' Avoid record locking ourselves out, save the actual record, if
dirty...
CurrentDb.Execute "UPDATE yourTable SET Attribute=" & NewAttribute & " WHERE ID IN(" &
ListOfIDtoModifyAttribute & ")"



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top