Bill Bisco
Active Member
- Joined
- Aug 8, 2007
- Messages
- 446
Hello all,
I have a continuous form that looks like this
It lists Processes that belong to this particular station. The Query that it's based off of uses Totals, and sums. As a result, it will only list processes that have have elements to them. As you can see in the next form:
If I add a Process, I must also add an element for it to appear so that the user can edit it.
So I must do one of these 2
1. Make my Add Record Button, add an Element to the Process that I create
2. Change my query so that it will list Processes that have no Elements
For 1. My Code so far is:
However, I do not know how to reference the record that I just created because it does not appear on my form and is not selected so rst.AddNew.Fields("Process ID") will not work to add an element.
For 2.
I have the following 3 items that would need to be converted to DSUM
I have tried:
TotalValueAdded: DSum(IIf([ValueAdded?]=True,[ElementTime],0))
DSum([ElementTime], "tblElements")
However, the format is wrong for the 1st equation, and the DSUM in the second equation sums up all the Element Times from the table whereas I need it to display only the sum of the Element Time for the specific process that is being displayed.
Any help is greatly appreciated.
Sincerely,
Bill
I have a continuous form that looks like this

It lists Processes that belong to this particular station. The Query that it's based off of uses Totals, and sums. As a result, it will only list processes that have have elements to them. As you can see in the next form:

If I add a Process, I must also add an element for it to appear so that the user can edit it.
So I must do one of these 2
1. Make my Add Record Button, add an Element to the Process that I create
2. Change my query so that it will list Processes that have no Elements
For 1. My Code so far is:
Code:
Private Sub cmdAddRecord_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strTable As String
Dim strFieldName As String
strTable = "tblProcesses"
strFieldName = Me![tblProcesses.StationID]
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strTable)
With rst
.AddNew
.Fields("StationID") = strFieldName
.Fields("Process Name") = "New Process"
.Update
End With
Me.Parent.Refresh
End Sub
However, I do not know how to reference the record that I just created because it does not appear on my form and is not selected so rst.AddNew.Fields("Process ID") will not work to add an element.
For 2.
I have the following 3 items that would need to be converted to DSUM

I have tried:
TotalValueAdded: DSum(IIf([ValueAdded?]=True,[ElementTime],0))
DSum([ElementTime], "tblElements")
However, the format is wrong for the 1st equation, and the DSUM in the second equation sums up all the Element Times from the table whereas I need it to display only the sum of the Element Time for the specific process that is being displayed.
Any help is greatly appreciated.
Sincerely,
Bill