Solved

Form Subform reference issue

Posted on 2014-02-05
2
494 Views
Last Modified: 2014-02-05
I have this in the control source of a field on a form:

=DSum("[ShipQty]","tblShipmentDetails","[ReadyID] = " & [Forms]![subfrmReady]![txtReadyID])

But it doesn't work and I think the reason is because I have to somehow reference the main form prior to the    [Forms]![subfrmReady]![txtReadyID]  part of the line.

??
0
Comment
Question by:SteveL13
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 39835910
try this

=DSum("[ShipQty]","tblShipmentDetails","[ReadyID] = " & [Forms]![Name Of MAIN Form][subfrmReady].Form![txtReadyID])


change "Name Of MAIN Form" with the actual name of the main form

if that does not work,

change "subfrmReady" with the name of the control that house the subform
0
 
LVL 36

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
ID: 39836151
A form only has one current record.  When you reference a subform from it's parent form or some other form, the ONLY record you can reference this way is the FIRST record in the subform's RecordSource.  Is that your intention?  Or is that what you think is wrong?

Tell us what you are trying to sum and we can offer another suggestion.  

A simple way to get a total for the subform's RecordSource is to add controls to the footer of the subform - they don't need to be visible.
=Sum(fld1)

Then in the main form, you have a control that references the control in the subform's footer.
= sfrmYoursubform.Form!txtSumOfFld1
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Empty Record being created 4 42
Slow running query - help 16 36
MS Access VBA How to export string to a text document within VBA 14 43
get and set file atrributes 5 10
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question