Requery form from another form

G

Guest

Hi

Having some frustrations with requerying objects from another form!
Would appreciate any help.

I have a form "frmAnecdoteManage" (recordsource of tblStudents)

On this form I have a listbox - lstAnecdotes. This listbox lists the
anecdotes for the student.

There is also a command button to open a new anecdote.

When this command button is clicked another form, "frmAnecdote" (record
source tblAnecdotes) opens so I can enter some data about a student - this is
a new record.

When this form closes I run the following code:

forms![frmAnecdoteManage].requery
forms![frmAnecdoteManage]![lstAnecdotes].requery

However, it doesn't requery!

So, I try:

forms![frmAnecdoteManage]![lstAnecdotes].rowsource="SELECT ......"

but that doesn't work either!

However, when I click the -> next record command on "frmAnecdoteManage" and
then the <-previous record command the list box displays the correct data.

What am I missing here?

Many thanks

Leonard
 
J

John Spencer

I suspect that the new record has not been saved at the point you are doing
the requery.

Try adding the following code to force the current record on frmAnecdote to
be saved.

If me.Dirty = True then Me.Dirty = False
Forms![frmAnecdoteManage]![lstAnecdotes].Requery


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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