Full Version: Listbox without subform
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
alorenzini
Is there a way to have a listbox linked to another table. Without using a subform.

Here is the situation.

I have a detail form based on (tblUnit) on which I have a tab control. One of the pages of the tab control will contain Note information. I have listbox control on this page which needs to have a record source pointed at my tblUnitNotes table. The list box current recordsource is this:

SELECT tblUnitNote.UnitNoteID, tblUnitNote.UnitID, tblUnitNote.NoteDate AS [Note Date], tblUnitNote.Note, tblUnitNote.NoteCategory AS Category
FROM tblUnitNote INNER JOIN tblUnit ON tblUnitNote.UnitID = tblUnit.UnitID;

I thought this would do it but when I change records on my Detail form the Notes list box stays on the same record in the tblUnitNotes. The linking field between the two is UnitID.

Any ideas?
projecttoday
Add

WHERE tblUnitNotes.UnitID = Forms.formname.UnitID

to the query. Then put Me.listboxname.Requery in the form's on current event.

Robert
alorenzini
That works! Thanks.
projecttoday
You're welcome.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.