combox update other table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Form1 for table1 has a combobox with a table lookup. If the user selects a
value, it is placed in field1 of table1.........but I also want that data
stored in field2 of table2...............I know this sounds redundant, but
never mind that.

1. Would I use AFTERUPDATE?
2. Would I use a FOR loop?

I am guessing at the code:
for each record in redundanttable2
if redundanttable2.id = table1.id then
if me.field1 = "category 1" or "category 2" then
set redundanttable2.filed2 = me.field1
else if ISNULL(me.field1) then ' the user may have made the
combox
' NULL using the
delete key
set redundanttable2.filed2 to be null also
else set redundanttable2.filed2 = "OTHER category"

exit for
end if
next

end sub
 
If the combo's bound column is not zero width, you can use the NotInList
event to add the new data to the look up table as well. Example at:
NotInList: Adding values to lookup tables
at:
http://members.iinet.net.au/~allenbrowne/ser-27.html

If the bound column is not what you display in the combo, use its DblClick
event to open a form into the lookup table so the user can add the details
of the record there. Then in the AfterUpdate and AfterDelConfirm events of
that form, Requery the combo on the original form so it gets to hear about
the changes.
 
you misunderstood my question and answered the question
you thought I was asking.

I don't need to add to any list. My list is fine as is. I
am trying to get one combobox to update two different
fields in two different tables:
 
Sorry, Mark. I can't make sense of that question.
Hopefully someone else can.

Presumably it involves executing some kind of Update query statement to
update some record in some other table.

--
 
Back
Top