Now i'm getting the message:
Run-time error 2465
Can't find the field 'Subform/Subreport: Sub' referred top in your
expression.
Is there anyway I can send to you privately please so we can sort this out
I would really appreciate it.
Thanks,
Neil
That is not what I posted:
Private Sub Form_Close()
Forms!MAIN![Subform/Subreport: Sub].Requery
End Sub
--
Ken Snell
<MS ACCESS MVP>
I've already tried that:
Forms!MAIN!Sub.Requery
and it still shows the same error?
message
OK, so the name of the subform control is "Subform/Subreport: Sub"?
Then
the
code would change to this:
Private Sub Form_Close()
Forms!MAIN![Subform/Subreport: Sub].Requery
End Sub
We don't need to include any reference to the tab page itself, as the
form
"owns" the controls on the tab page as well.
--
Ken Snell
<MS ACCESS MVP>
Access 2002 (10.6501.6735) SP3
message
Which version of ACCESS are you using?
--
Ken Snell
<MS ACCESS MVP>
The name states Subform/Subreport: Sub
(Summary is the page name (for the selected tab - on the multitab
page)
Would it be easier for me to send you the database file, then you
can
tell
me where i'm going wrong and i can explain to the group to
help
others
with
the possible same problem.
Thanks.
Neil
message
The error suggests that you're not using the correct name of the
main
form
or the correct name of the subform control that is on that main
form.
I don't know what you mean by "the tab is Summary"? What was the
name
in
the
Name property in the Other tab when you opened the Properties
window
after
clicking on the top of the subform while the main form is in
design
view?
--
Ken Snell
<MS ACCESS MVP>
Thanks. Think i'm getting to grips with this now.
Although now the problem shows up as ;
"The Expression you entered refers to an object that is closed
or
does
not
exist"
I have checked the name of the form and the tab is Summary and
the
Sub
form
has a name SUB, which i changed the requery to reflect either,
but
still
the
same error? (Forms!MAIN!Sub.Requery or Summary.Requery)
Any idea's. I really do appreciate this help. It's
getting
me
further
to
understand what is going wrong rather than just telling me the
answer...
Thanks.
Neil M
message
Are you sure that the subform control (the subform control is
the
control
on
the main form -- that control holds the subform object) is
named
Summary?
The name of this control may not be the same name as the form
that
is
the
subform object. Open the form in design view, click on the
top
edge
of
the
subform, open Properties window, and see what the name is on
the
Other
tab.
Also, as I understand your setup, you're entering data in the
popup
form
that you then want to be shown in the subform, right?
Let's
try
this
code
in
these events for the popup form.
Let's use the Click event of the button (SAVE and EXIT button
that
you
put
on the form) to do this code (saves the record and closes the
form):
Private Sub YourButtonsName_Click()
Me.Dirty = False
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
Then let's use the Close event of the popup form to run this
code
(requeries
the main form's subform, if the names are correct):
Private Sub Form_Close()
Forms!MAIN!Summary.Requery
End Sub
The DoEvents statement is a way to tell ACCESS to "pause" and
let
things
catch up. It returns control to the PC so that it can do
other
things,
then
ACCESS regains control and continues. It's a common way to
let
things
finish
before the code continues.
--
Ken Snell
<MS ACCESS MVP>
What is the DoEvents command?
Also, just to let you know the subform still is not
updating????
Any other idea's?
Regards,
Neil
in
message
Do the requery before you close.
DoCmd.DoMenuItem acFormBar, acRecordsMenu,
acSaveRecord,
,
acMenuVer70
DoEvents
Forms!MAIN!Summary.Requery
DoCmd.Close
--
Ken Snell
<MS ACCESS MVP>
Actually got it exiting the form now, but my next
problem
is
that
the
list
is still not updating in Summary..
I close the pop-up form using a SAVE AND EXIT command
button
with
this
code;
DoCmd.DoMenuItem acFormBar,
acRecordsMenu,
acSaveRecord,
,
acMenuVer70
DoCmd.Close
Forms!MAIN!Summary.Requery
But the new record is still not being shown on the
summary
list
unless
i
update (using a combo box to list OPEN or CLOSED)
Any further help would be appreciated and I do
appreciate
all
the
help
thus
far
Thanks.
Neil
Thanks.
But now i'm getting this error:
Run-time error 438
Object doesn't support this property or method
My code is this;
Private Sub Form_Close()
[Forms]![Main]![Summary]![Sub].Requery
End Sub
Any further help would be appreciative
Thanks.
Neil
"Ken Snell [MVP]" <
[email protected]>
wrote
in
message
Use the Close event of the popup form to run this
code
step:
Forms!MAIN!SUMMARY.Requery
This assumes that the name of the subform control
(the
control
on
MAIN
that
is actually holding the subform object) is named
SUMMARY.
--
Ken Snell
<MS ACCESS MVP>
Hi all,
Ive asked this question before a different way but
got
no
resolution.
So here's my problem again, please advise on
alternative
workarounds
or
a
solution;
How do requery a subform on another form from a
seperate
form?
I have a MAIN form that display a datasheet subform
named
SUMMARY
I click ADD on the main form and it brings up a new
window
to
add
(or
edit)
the record.
but when the new window closes the subform doesn't
update
with
the
new
information.
How do i update this subform after closing the
NEWREC
form,
so
the
summary
subform updates with any new records just added or
edited.
(the
summary
holds user id and a few other bits of info)
Clicking on the record id on the subform opens the
record
details,
which
works correctly at the moment.
Any extra help would be great - i want to try
and
finish
this
database
and
this is the only thing stopping me at the
moment.
Thanks,
Neil