How to Requery across Subforms ?

G

Guest

I have two separate subforms within one mainform. Using Macros only (because
I have no idea how to write code) how can I make the clicking of a check box
in one subform trigger the requery of a control in the other subform WITHOUT
triggering a requery of any other data in any of the forms?

Thanks.
 
S

Steve Schapel

FJ,

I have read your question over, trying to imagine what you are doing
that produces this requirement. I suppose the control on the other
subform must be a combobox or listbox, right?

But anyway, I guess your macro would be assigned on the After Update
event of the checkbox. I didn't test this, but I think the Control Name
argument would be set to the equivalent of:
[Parent]![OtherSubformName]![ControlOnOtherSubform]
 
G

Guest

Thanks Steve.

Your suggestion is what I've been trying but without succes.

My main form tacks the date and cheque number of cheques I'm writing. It has
three subforms each of which displays a different type of payment I can make
and the applicable payables. Each form has a check box where the user
indicates which bills are to be paid. Only unpaid nills are displayed in
these subforms.

The 4th subform is based on a query which totals the bills checked in the
other 3 subforms. So each time I click a checkbox I need it to prompt a
requery of the "total" query. However, I don't want to requery the subform
where the check mark is clicked otherwise that bill is eliminated from the
subform and hence the total (because the subforms only showed unpaid bills).

I have the checkbox runa macro after updating. THe macro is a simple Requey.
But no matter how I define the control to requery, an error message diplays.
The only control it will accept is one in the same subform as the checkbox
that triggers the macro. I don't knopw why Access won't let me trigger a
macro in one subform that affects a control in a sister subform. But when
you look at the macro for Requery, the spcae where you fill in the control
does not allow you to look up a control the way other macro instructions (eg.
set value) does. This seems to imply too that it only wants simple control
names from within the same form.

Any suggestion? (assuming I've not muddied the waters with this explanation).






Steve Schapel said:
FJ,

I have read your question over, trying to imagine what you are doing
that produces this requirement. I suppose the control on the other
subform must be a combobox or listbox, right?

But anyway, I guess your macro would be assigned on the After Update
event of the checkbox. I didn't test this, but I think the Control Name
argument would be set to the equivalent of:
[Parent]![OtherSubformName]![ControlOnOtherSubform]

--
Steve Schapel, Microsoft Access MVP
I have two separate subforms within one mainform. Using Macros only (because
I have no idea how to write code) how can I make the clicking of a check box
in one subform trigger the requery of a control in the other subform WITHOUT
triggering a requery of any other data in any of the forms?

Thanks.
 
S

Steve Schapel

FJ,

Sorry, I don't know. I have tested out what you said, and you are
right. I think using VBA rather than a macro will allow you to do it.
 
G

Guest

Thanks. Here's what I coded:

Private Sub AdvancePaid_AfterUpdate()
Me.[Cheques to Assignor]![Cheques to Assignor Totals by
Cheque].Form![ChequeTotal].Requery
End Sub

However, I get the error message: Access can't find the field "|" referred
to in your expression.

Does that make sense?

Thanks.

FJ
 
S

Steve Schapel

FJ,

I can't really comment without knowing what all this means.

What is the name of the form that the AdvancePaid control is on? If
this is a subform, what is the name of the main form that this subform
is on? What is [Cheque Total]? What is [Cheques to Assignor Totals by
Cheque]? What is [Cheques to Assignor]?
 

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

Similar Threads


Top