Access Problem ( I want to deselect some rows from a list box contents)

J

Jenny Gao

Hi, I wanted to remove some rows from a list box contents
with 3 different column names, each row has no unique key
(ie. Data in the list box as below:
intYear strHomeGroupID strHomeGroupName
2002 000457700 ABCD
2002 000553300 BCDFGG
2003 000457700 ABCD )

which means if I use a find method, I have to have a
criteria looking for three columns for each row search.
Does anybody know how to solve this problem? Thanks,Jenny
 
J

JohnFol

If the listbox is based upon values you can do the following

Me.List0.RemoveItem (Me.List0.ListIndex)

If it's bound to some data, and you want to remove the rows from the
underlying table you have a problem. If the row does not have something to
identify it, you may delete more that 1 row from the table.

Rather than use find (I presume on a recordset) you could do
docmd.RunSQL "Delete from Table where field1 = "
&
me.List0.Column(0,me.List0.ListIndex)
& " AND Field2 = " &
me.List0.Column(1,me.List0.ListIndex) &
& " AND Field3 = " &
me.List0.Column(2,me.List0.ListIndex)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top