change subform child link

G

Guest

Hi

i change subform childlink via selection on combobox in after event using
following code:
Me.Subform.LinkChildFields = "SomeField"
which works fine. but i also have a field on main form which adds together
totals from 2 subforms. after changing childlink the field on the main form
shows #Error, even though the totals on each subform still show amounts. i
use the following code to add together the 2 subform totals:
=IIf([Forms]![MainForm]![Subform].[Form].[RecordsetClone].[RecordCount]>0,nz([Forms]![MainForm]![Subform]![sumtotal],0),0)+IIf([Forms]![MainForm]![Subform1].[Form].[RecordsetClone].[RecordCount]>0,nz([Forms]![MainForm]![Subform1]![sumtotal],0),0)
the same #Error shows when moving to other records in mainform

any thoughts on why this is happening and how to fix?

thanks
 
G

Guest

Hi, David.
any thoughts on why this is happening and how to fix?

Do you have a relationship established between the "SomeField" and the field
used for the LinkMasterFields Property? If not, attempt to create one --
just for testing purposes. Is the Relationship Type in the Edit
Relationships dialog window "Indeterminate"? It should be one-to-many or
one-to-one.

Are you using Access 2003? Access 2003 subforms have some bugs that require
that the linked fields be bound to controls on the form and subform
(LinkMasterFields field on main form and LinkChildFields field on subform).
If you have not designed your form/subform this way, bugs may be interfering.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Hi

i change subform childlink via selection on combobox in after event using
following code:
Me.Subform.LinkChildFields = "SomeField"
which works fine. but i also have a field on main form which adds together
totals from 2 subforms. after changing childlink the field on the main form
shows #Error, even though the totals on each subform still show amounts. i
use the following code to add together the 2 subform totals:
=IIf([Forms]![MainForm]![Subform].[Form].[RecordsetClone].[RecordCount]>0,nz([Forms]![MainForm]![Subform]![sumtotal],0),0)+IIf([Forms]![MainForm]![Subform1].[Form].[RecordsetClone].[RecordCount]>0,nz([Forms]![MainForm]![Subform1]![sumtotal],0),0)
the same #Error shows when moving to other records in mainform

any thoughts on why this is happening and how to fix?

thanks
 

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