List Boxes Do Not Requery (Access 2003) (1 Viewer)

AlanJBS

New member
Local time
Yesterday, 16:24
Joined
Feb 12, 2009
Messages
10
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
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 00:24
Joined
Jul 9, 2003
Messages
16,282
Try "Refreshing" the form itself, as well...
 

AlanJBS

New member
Local time
Yesterday, 16:24
Joined
Feb 12, 2009
Messages
10
Thanks Uncle Gizmo - but sorry - it didn't work :(
 

Users who are viewing this thread

Top Bottom