G
Guest
Hi,
I have a subform with link master on a listbox. It works perfectly
(when an item -pk is selected in the listbox, data in corresponding record is
retrieved and populated into subform). However, it doesn't work under the
following scenario:
I have a command button which adds new items into listbox (since that a
new entry - therefore no record is associating with that pk). When that's
clicked it 1) runs SQL statement to add that record into table and add the
new item (autonumber) into listbox -which works fine. 2) set listbox selected
item to true
ListBatch.Selected(ListBatch.ListCount - 1) = True -- which also works.
However, the subform is not updated (it stays on the whatever selected
previously). If I clicked on the selected item, then the correct data is
populated.
It seems like highlighting a listbox item is not as same as clicking it.
Can someone please tell me how can I work around it?
Thanks
I have a subform with link master on a listbox. It works perfectly
(when an item -pk is selected in the listbox, data in corresponding record is
retrieved and populated into subform). However, it doesn't work under the
following scenario:
I have a command button which adds new items into listbox (since that a
new entry - therefore no record is associating with that pk). When that's
clicked it 1) runs SQL statement to add that record into table and add the
new item (autonumber) into listbox -which works fine. 2) set listbox selected
item to true
ListBatch.Selected(ListBatch.ListCount - 1) = True -- which also works.
However, the subform is not updated (it stays on the whatever selected
previously). If I clicked on the selected item, then the correct data is
populated.
It seems like highlighting a listbox item is not as same as clicking it.
Can someone please tell me how can I work around it?
Thanks