Requery List Box from another Form

G

Guest

MS Access 2000

A form named frmA has a list box named lstboxA.

lstboxA has a rowsource that is set in code when frmA is opened. The rows
appear in a certain sort order.

frmB is opened from frmA. frmA remains open and visible.

The user makes data changes in frmB. The rowsource in lstboxA on frmA can
be changed by the information that is saved in frmB.

When frmB is closed, the rows in lstboxA do not appear in the same sort
order as they appeared when frmA was opened.

How can I make the rowsource of lstboxA appear in the same sort order as it
did when frmA was first opened? That is, how can I reset the rowsource of
lstboxA in frmA when frmB is closed?

I have run this code from the unload event of frmB:

Forms!frmA.lstboxA.Requery

And I receive this error:

‘Application-defined or object-defined error’



If I am on the wrong track, how can I call a function in frmA from frmB?


Thanks for your help.
 
G

Guest

Arvin,

Thanks - this works well!

I am sure I have used the syntax "Forms!frmA.lstboxA.Requery" to requery a
listbox on another form before (possibly in another version of MS Access).
By the way, the query is not a saved query in MS Access - it is a string and
I set the rowsource in code if that makes nay difference.

Why do you think that syntax does not work now?

Wayne
 

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