phantom row in listbox (1 Viewer)

AlanS

Registered User.
Local time
Today, 13:52
Joined
Mar 23, 2001
Messages
292
I have an Access 2003 form which uses three unbound listboxes, all of which are populated by queries on the fly. The first one displays records from a parent table, and the other two display corresponding records from two child tables. As the selection is changed in the first listbox, the other two are automatically updated to display the matching records (if any). All this is accomplished by programmatically setting the RowSource property and then the Requery method, and it mostly works as expected.

The problem is that even when there are no matching records in the child tables, each of their corresponding listboxes still shows a single "phantom" record, with all of the columns null but the column dividers in place. The user is able to select the phantom record, which causes the highlight to appear and the the ListCount property to be set to 1. This does not happen with the parent listbox. It's causing me great problems, as various command buttons must be enabled or disabled on the fly depending on the ListCount value of each of the listboxes and whether or not a row is selected in each of them.

How can I get rid of the phantom rows?
 

namliam

The Mailman - AWF VIP
Local time
Today, 19:52
Joined
Aug 11, 2003
Messages
11,695
I think (have not checked to make sure) if you enter a recordset (query) as the rowsource there is allways that one (empty) record there.

I also think that if you double check the content of the rowsource to actually contain records, you can remove the rowsource (rowsource = "") if the recordcount of said rowsource = 0. No rowsource = no empty record (I think)
 

Users who are viewing this thread

Top Bottom