How to Use Recalc

D

DOYLE60

How do I write code to Recalc a subform on an unbound dialog form?

I see two methods:

Forms![Mainfrm]![Subfrm].Form.Recalc
Forms("Mainfrm").Subfrm.Form.Recalc

Neither of these happen to solve my problem, but I'd thought I'd ask.

Thanks,

Matt
 
M

Marshall Barton

DOYLE60 said:
How do I write code to Recalc a subform on an unbound dialog form?

I see two methods:

Forms![Mainfrm]![Subfrm].Form.Recalc
Forms("Mainfrm").Subfrm.Form.Recalc

Neither of these happen to solve my problem, but I'd thought I'd ask.

Both of those are equivalent and correct.

Instead of pursuing this question, you should start a new
question that describes the problem you're trying to solve
and just mention that Recalc didn't take care of it.
 
J

John Nurick

If you want to make it absolutely clear what's happening, you could use
Forms("Mainfrm").Controls("Subfrm").Form.Recalc
or, if the code is in the form's own module, which will (almost?) always
be the case with a dialog form,
Me.Controls("Subfrm").Form.Recalc

In practice I usually use
Me.subfrmXXX.Form.Recalc
where subfrmXXX is the name of the subform control.


How do I write code to Recalc a subform on an unbound dialog form?

I see two methods:

Forms![Mainfrm]![Subfrm].Form.Recalc
Forms("Mainfrm").Subfrm.Form.Recalc

Neither of these happen to solve my problem, but I'd thought I'd ask.

Thanks,

Matt
 
D

DOYLE60

Thanks John, but none of your 3 Recalc lines work for me. Someone asked me to
post the question again. Here is the original question:
_______________________

I have a subform that only partly requeries when I click a command button to
requery it. It only requeries the combo boxes, but not the list boxes.

The main form is unbound and contains the combo and list box filters and the
subform. The subform's control source, the query, filters the listboxes by
drawing up the queries the list boxes update, and the combo boxes by an
expression in the criteria row.

I know that the query of the sub works and that both types of filters work for
two reasons. First, the report is based on the very same query and it filters
the combo and list boxes properly. Second, when I shuffle back and forth from
the form view to the design view and back to the form view again, the subform
is properly requeried, both combobox and list boxes.

The button on the form to requery the sub has code to update the listbox
queries followed by the requery action: Child83.Requery.

How do I supercharge this subform? How do I get it to fully requery? That it
only requeries partly seems impossible to me. I tried looking at repaint,
refresh, and all that, but no go.

Thanks,

Matt
_________________________

It was suggested to me to use the Recalc. I've tried about 6 different
syntaxes and nothing is working. The subform's name is InventoryDialogUnitsSub
and the source object is the same. This is what the Wizard did. Is it okay
for the Name and source object to be the same? I tried making them different
and using your code. But still no go.
If it matters, the query the sub is based on is:
InventoryTrend10TotalSAPUnitsqry.

I've been struggling with this for over two weeks. I don't quite get it.
Never had this issue before.

Thanks a lot,

Matt



If you want to make it absolutely clear what's happening, you could use
Forms("Mainfrm").Controls("Subfrm").Form.Recalc
or, if the code is in the form's own module, which will (almost?) always
be the case with a dialog form,
Me.Controls("Subfrm").Form.Recalc

In practice I usually use
Me.subfrmXXX.Form.Recalc
where subfrmXXX is the name of the subform control.


How do I write code to Recalc a subform on an unbound dialog form?

I see two methods:

Forms![Mainfrm]![Subfrm].Form.Recalc
Forms("Mainfrm").Subfrm.Form.Recalc

Neither of these happen to solve my problem, but I'd thought I'd ask.

Thanks,

Matt
 
M

Marshall Barton

DOYLE60 said:
I have a subform that only partly requeries when I click a command button to
requery it. It only requeries the combo boxes, but not the list boxes.

The main form is unbound and contains the combo and list box filters and the
subform. The subform's control source, the query, filters the listboxes by
drawing up the queries the list boxes update, and the combo boxes by an
expression in the criteria row.

I know that the query of the sub works and that both types of filters work for
two reasons. First, the report is based on the very same query and it filters
the combo and list boxes properly. Second, when I shuffle back and forth from
the form view to the design view and back to the form view again, the subform
is properly requeried, both combobox and list boxes.

The button on the form to requery the sub has code to update the listbox
queries followed by the requery action: Child83.Requery.

How do I supercharge this subform? How do I get it to fully requery? That it
only requeries partly seems impossible to me. I tried looking at repaint,
refresh, and all that, but no go.


What is Child83?

If it's the name of the subform control on the main form,
then the syntax should be:

Child83.FORM.Requery

However, if you didn't get an error from what you had, I'm
not sure this will make a difference.
 
D

Dirk Goldgar

Marshall Barton said:
What is Child83?

If it's the name of the subform control on the main form,
then the syntax should be:

Child83.FORM.Requery

However, if you didn't get an error from what you had, I'm
not sure this will make a difference.

Unless Access 2003 has changed things, it says in the help file and has
been my observation in practice that requerying a subform control has
the same effect as requerying its Form object.
 

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