List Box Does Not Requery (Access 2003)

A

AlanJBS

Using Access 2003 - I have a form with two list boxes. Both row sources for
the list boxes are based on queries from the same table.

The rowsource query for List Box A has a criteria to include records only if
a particular field's value is zero (lets call it Field1).

The rowsource query for List Box B has a criteria to include records only if
Field1 has a value greater than zero.

If the user selects a line in List Box A and clicks a command button, that
triggers off some code which puts a value in Field1 of the underlying table.

It is simple DAO code...

Rst.Edit
Rst!Field1 = [NewValue]
Rst.Update

.... and the table does change appropriately

This should have the effect of moving the selected item from List Box A to
List Box B when they are requeried. So therefore I have followed the table
update code with code that uses the requery command for the list boxes,
namely:

Me.[List Box A].requery
Me.[List Box B].requery

But it doesn't work - the list boxes do not requery.

If F9 is pressed, they will requery but I don't want the user to have to
remember to do this. I have tried using SendKeys "{F9}" after the requery
commands above but that doesn't work.

I have tried putting DoEvents before and after the requery commands but that
doesn't work.

These requery commands are also on the OnCurrent event. If you manually move
to the previous or next record and return to the original, the list boxes
requery. If I try to move to previous or next and then return to the original
using code, once again it doesn't work.

I have used this double list box technique in earlier versions of Access and
it worked OK.

Any help gratefully appreciated

Alan
 

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