Updating listbox when records have been changed

  • Thread starter Thread starter hootyeah
  • Start date Start date
H

hootyeah

I have a main form named "Jobs" which contains the subform
"JobRoomDetails" - "Jobs" has a one-to-many relationship with
"JobRoomDetails". Both set to single form.

"JobRoomDetails" contains a combo called "Rooms" that assigns a
"RoomID" for every JobRoom record. Also on this form is a listbox
"JobRoomSelect" that I use to display all of the relevant JobRoom
records (all records that share the same JobID), with code in the
AfterUpdate property to find the matching record in the sub
"JobRoomDetails" This works fine except when I update the "Rooms" combo
it dosent update the listbox "JobRoomSelect" with the new "RoomID",
even when I have included the following in the "Rooms" combo
AfterUpdate property:

Forms!Jobs!Child89.Form!JobRoomSelect.Requery

The listbox will show the correct data when I re-open the form, and
even when it does display the old RoomID - selecting this will show the
updated record, but I would like the list box to display the updated
records the moment I assign a new RoomID.

What am I doing wrong?

Cheers in advance.
 
It it difficult to tell from the description but it may be that the field is
being updated, hence the "AfterUpdate" event has fired but the records have
not been updated. So the requery is picking up the records as they still
are.

You didn't say how the combo box "assigns a [RoomID] for every JobRoom
record". Does it execute an UPDATE query or a subroutine that used DAO or
ADO to read through all of the records and update them?

You mentioned a form named "Jobs" and a form named "JobRoomDetails" but you
didn't say what tables these forms displayed. Does "JobRoomDetails" show
records from the [JobRoomDetails] table or the [JobRoom] table. You said
that a combobox on the "JobRoomDetails" form assigns a RoomID for every
[JobRoom] record. Is this one RoomID that is the same on all of the
[JobRoom] records for a JobID or is it a separate RoomID for each [JobRoom]
record?

Do you have two tables: [Jobs] and [JobRoomDetails] or three tables: [Jobs],
[JobRoomDetails], and [JobRoom]?

Lee Robinson
 
Back
Top