I have tried to search for an answer on this elsewhere, and it is likely easy to fix, but I am having no luv. I included the function I have written below. This function is to look at a record in table T, make some comparisons and if criteria is met, open and edit a record in table S with the data from table T. I am confused just typing that. lol. Anyway, I keep getting an error at the line s.Edit (which was EditMode, but that did not work either). That is the line that is supposed to open and edit the records into the S table. I am not sure where I am going wrong. Ideas would be welcome. Thanks.
Function calc_bulk_levels()
'Dim w As Workspace
'Dim db As Database
Dim t As Recordset
Dim s As Recordset
Dim r, v, x As Integer
Dim u, y, z As String
Set w = DBEngine.Workspaces(0)
Set db = w.Databases(0)
Set t = db![tbl: Level Load Testing].Openrecordset()
Set s = db![tbl: Summary of Analysis].Openrecordset()
t.MoveFirst
s.MoveFirst
u = t![Base Num]
x = 0
v = 0
Do Until t.EOF
If t![Base Num] = u Then
If x = 0 Then
x = x + t![Bulk Qty]
v = t!
If x <= v Then
t.MoveNext
End If
Else
x = x + t![Bulk Qty]
If x <= v Then
t.MoveNext
Else
s.Edit
s![Base Num] = u
s![MRP Controller] = y
s![Bulk Qty] = x
s![Inventory] = v
s![Basic Start Date] = z
s.Update
Do Until t.[Bas Num] = !u
t.MoveNext
Loop
End If
End If
y = t![MRP ctrlr]
v = t!
z = t![Bsc start]
Else
u = t![Base Num]
End If
Loop
End Function
Function calc_bulk_levels()
'Dim w As Workspace
'Dim db As Database
Dim t As Recordset
Dim s As Recordset
Dim r, v, x As Integer
Dim u, y, z As String
Set w = DBEngine.Workspaces(0)
Set db = w.Databases(0)
Set t = db![tbl: Level Load Testing].Openrecordset()
Set s = db![tbl: Summary of Analysis].Openrecordset()
t.MoveFirst
s.MoveFirst
u = t![Base Num]
x = 0
v = 0
Do Until t.EOF
If t![Base Num] = u Then
If x = 0 Then
x = x + t![Bulk Qty]
v = t!
If x <= v Then
t.MoveNext
End If
Else
x = x + t![Bulk Qty]
If x <= v Then
t.MoveNext
Else
s.Edit
s![Base Num] = u
s![MRP Controller] = y
s![Bulk Qty] = x
s![Inventory] = v
s![Basic Start Date] = z
s.Update
Do Until t.[Bas Num] = !u
t.MoveNext
Loop
End If
End If
y = t![MRP ctrlr]
v = t!
z = t![Bsc start]
Else
u = t![Base Num]
End If
Loop
End Function