Re: Requery problem



Depends what you mean by "modal". When you open the form you need to
specify acDialog for the WindowMode argument of DoCmd.OpenForm. Merely
setting the "modal" property of the form will not achieve what you want, as
you appear to have discovered.

"Lyn" <l.han***@xxxxxxxxxxxx> wrote in message
news:bbhnyasvp4mi.upp1eq83oyw1$.dlg@xxxxxxxxxxxxx
Hi,
I am using a form (FormA) to list the records in a recordset. In the
FormA
footer, I have an "Add" command button that opens a new form (FormB)
modally which is used to input and save a new record to the table on which
the recordset is based.

On closing FormB after inputting a new record, I would like to
refresh/requery the listing in FormA automatically so that it includes the
new record. I don't seem to be able to get this to work in the sense of
triggering the requery.

The event procedure for the FormA "Add_click" opens FormB. According to
the Help manual, opening a modal form is supposed to disable the calling
form until the the modal form is closed. But that does not seem to apply
to the VBA procedure that opened the modal form -- if I put the requery
later in the "Add_click" procedure (in FormA), this procedure doesn't seem
to stop while FormB is open, and so the requery occurs before any data can
be entered in FormB. What I need is similar functionality to the MsgBox
which is a kind of form -- everything stops till the user closes the
MsgBox. I have also tried setting Popup with no improvement.

The only other thing I can think of that should work is to use the Close
event of FormB to trigger the FormA requery. That seems a bit messy and I
am not sure of the syntax for calling a procedure in another form (which
contains the requery code). That is, calling a FormA procedure from the
Close event of FormB.

I am probably going about this all wrong -- would appreciate someone
showing me the errors of my ways :-)

TIA,
Lyn.


.