Subform's Form_Current is Triggered When Value in Parent Form is Changed

R

Robert Robichaud

I have a main form with 2 subforms.

Each subform is linked to the parent via LinkChildFields and
LinkMasterFields. Each time I set a value in the Parent form, the first
subform's Form_Current is triggered followed by the second's subform's
Form_Current. This only started to happen after I migrated from .mdb to
..adp.

Any suggestions?
 
A

Allen Browne

When you move to a new record in the main form, Access has to locate the
right records to match in the subform (based on the
LinkMasterFields/LinkChildFields), and load them. Since this means loading
records into the subform, why would it Current event *not* fire?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:%[email protected]...
 
R

Robert Robichaud

That's what I would expect and it does that.

My problem is that I'm only changing the value of some of the fields in the
main form and the Form_Current event is trigger in each subform. I am not
moving to another record.

Any ideas on what's going on?
 
A

Allen Browne

Okay. What is in the LinkMasterFields: the name of a field in the main
form's RecordSource? The name of a *calculated* control?

Does this happen only when the main form record is saved?

Is there anything else that could trigger a recalculation (such as
conditional formatting)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
 
R

Robert Robichaud

The LinkMasterFields name is OrderID (Key Indexed field in the table Orders)
and is not a calculated field.

It happens when I change the value of a field on the main form that is tied
to the currently displayed record.

No. When stepping through in debug mode, after a field is assigned a valude
(e.g. Me!ShipDate = Now() ), the first subform's Form_Current is triggered.
As soon as the 1st Form_Current method is finished (via Exit Sub statement),
the 2nd subform's Form_Current is triggered. When the 2nd subform
Form_Current method is finished, it returns back to the next statement in
the main form.
 
A

Allen Browne

Robert, I cannot reproduce that here in Access 2003.

I have a fairly simple main form (invoice), with a subform (invoice
details), and in the subform's Current event:
Debug.Print Me.Module.Name & ".Current fired at " & Now()

That fires (twice actually), when:
- the main form loads,
- the main form *saves*,
- the main form undoes,
- the main form moves record.

It does not fire when I type a value into a control in the main form, nor
when I programmatically assign a value to a control in the main form:
Forms(0).InvoiceDate = Date()
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
 
R

Robert Robichaud

Allen,

I should have mentioned in my first posting that I'm running Access 2000.
It should not make a difference but I'm still having this problem.

Any suggestions would be welcomed on what I should check for, reference
pages on the web or how to debug it?

Thanks.
 
A

Allen Browne

Have just set up the same scenario in A2000. Same result. The subform's
Current event does not fire when the field is entered manually or
programmatically - not until the record is saved or undone.

Not sure what else to suggest.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
 
R

Robert Robichaud

Allen,

Thank you anyways for trying to help. I've copied the source over to a new
..adp file and still receive the same results: both subform's Form_Current
are triggered when a field in the record is changed on the main form.

Been "googling" all over to try to find something on this but no luck. I'll
keep trying.

Regards,

Robert
 
R

Robert Robichaud

To add to this, I'm running Access 2000 .adp.

If it helps, the Reference library is as follows:

Visual Basic For Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft DAO 3.6 Object library
Microsoft ActiveX data Objects 2.7 Library
Microsoft ActiveX Data Objects Recordset 2.8 Library

Suggestions?
 

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