Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display A Specific Result

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
In the database that I have developed, I have a Form and a subform. The subform keeps track of specific delays incurred during a manufacturing process. The subform consists of the following fields, which are formatted as follows:

DelStart - Short Time
DelFinish - Short Time
Dur - Number (Which is the difference between DelFinish and DelStart)
DelCode - Text (Drop down list of all Delay Codes associated with the process)
Note - Memo field in which the user inputs any comments regarding delays of
an usual or excessive duration.

The Main form and the subform are linked on a one-to-many basis by use of the 'Auto-number' Primary key.

I then inserted a field in the subform footer which calculates the total delay for that particular process and this, in turn, is used to display the total delay on the Main Form.

Everything about this database runs just fine and my boss was very happy with its use.
That is, up until the time he asked if I could also display the total duration of a particular DelCode on the Main Form. I've been beating my head against a stone wall on this one and any assistance or direction provided to lead me to a solution will be greatly appreciated.

Thank you in advance.
 
I'm answering my own question here, but if you have come across the same problem or are interested in the answer, here's what I did to solve the problem:

1. In my base table, I added another field. Naming the field based upon which specific delay I wished to display.
e.g.NCDel

2. This new field, was then added to the Details Section of the subform, and the following code snippet was placed in the "OnCurrent" event of the subform:

If [DelCode]="03" Then
[NCDel] = [Dur]
Else [NCDel] = "0"
End If


3. The next step was to create a text box in the subform footer, naming it sfrmTotNCDel, and using a Control Source Code of =Sum([NCDel]).

4. Finally, on the Main Form, a text box was added, named
"NCDel" and the Control Source was made to show =[sfrmDmpDelay].[Form]![sfmTotNCDel]

After testing to insure that it works, the subform footer was made to be invisible, the added text box in the subform Detail Section was made invisible and the darn thing works like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top