D
Derek Wittman
Good morning
I've got a small problem (well, it's probably small). I keep getting an error message: Runtime 3420 Object Invalid or No Longer Set... I cannot see the cause in the code. Can someone please take a gander at it and offer some pointers
Thank you
Sub CigLogic(
Dim dbs As DAO.Database, rstCumArm1 As DAO.Recordse
Dim curInter, curToCase, cur6s, cur2s, cur1s As Doubl
Dim previnter, curCumArm, nextCumArm As Intege
DoCmd.RunSQL ("CREATE Table CumArm1(Cumarm double null, Inter double null, ToCase double null, 6s double null, 2s double null, 1s double null)"
'Following line creates an empty arm to hold things at the beginning of a shif
DoCmd.RunSQL ("INSERT INTO CumArm1 (Cumarm, Inter, ToCase, 6s, 2s, 1s) Values (0,0,0,0,0,0)"
'Following line copies my independant field (all records) into the table created above
'Since I'll be working on aggregate functions, I'd rather work in a table than keep hitting my query
DoCmd.RunSQL ("INSERT INTO CumArm1 ( Cumarm ) SELECT qryCumArm.CumArm FROM qryCumArm"
'Setting up the recordse
Set dbs = CurrentD
Set rstCumArm1 = dbs.OpenRecordset("CumArm1", dbOpenTable
With rstCumArm
.MoveLas
.MoveFirst 'my record of 0's. I'm not working calculations on this one
While Not .EOF 'starting my loop (supposedly...
.MoveNext ' going to my first 'real' data value (Note: Record X is current
curInter = 0 'reset curInte
.MovePrevious
previnter = !inter 'put (X-1) value of 'inter' field to previnte
.MoveNex
.MoveNex
nextCumArm = !CumArm 'put (X+1) value of CumArm to nextCumAr
.MovePreviou
If previnter + !CumArm + nextCumArm > 12 Then 'start making decisions - if TRUE then start putting from arm into cas
curInter =
curToCase = previnter + !CumAr
cur6s = Int(curToCase / 6
cur2s = Int((curToCase - cur6s * 6) / 2
cur1s = curToCase - 6 * cur6s - 2 * cur2
Else: curInter = previnter + !CumArm 'since it's not TRUE then continue to accummulate into ar
curToCase =
cur6s =
cur2s =
cur1s =
End I
.Edit 'time to start updating the recordset to the held variable value
!inter = curInte
!tocase = curToCas
![6s] = cur6
![2s] = cur2
![1s] = cur1
.Update 'time to move the values from the recordset to the datatabl
.Clos
Wend 'supposedly to go back to the WHILE NOT star
End Wit
Set dbs = Nothin
End Su
I'm dizzy. I really appreciate any help offered, even links to informative sites. The odd thing is that I have checked out is ng and it seems (to me, anyway) that I'm following the demonstrated examples
Thank you in advance
Derek
I've got a small problem (well, it's probably small). I keep getting an error message: Runtime 3420 Object Invalid or No Longer Set... I cannot see the cause in the code. Can someone please take a gander at it and offer some pointers
Thank you
Sub CigLogic(
Dim dbs As DAO.Database, rstCumArm1 As DAO.Recordse
Dim curInter, curToCase, cur6s, cur2s, cur1s As Doubl
Dim previnter, curCumArm, nextCumArm As Intege
DoCmd.RunSQL ("CREATE Table CumArm1(Cumarm double null, Inter double null, ToCase double null, 6s double null, 2s double null, 1s double null)"
'Following line creates an empty arm to hold things at the beginning of a shif
DoCmd.RunSQL ("INSERT INTO CumArm1 (Cumarm, Inter, ToCase, 6s, 2s, 1s) Values (0,0,0,0,0,0)"
'Following line copies my independant field (all records) into the table created above
'Since I'll be working on aggregate functions, I'd rather work in a table than keep hitting my query
DoCmd.RunSQL ("INSERT INTO CumArm1 ( Cumarm ) SELECT qryCumArm.CumArm FROM qryCumArm"
'Setting up the recordse
Set dbs = CurrentD
Set rstCumArm1 = dbs.OpenRecordset("CumArm1", dbOpenTable
With rstCumArm
.MoveLas
.MoveFirst 'my record of 0's. I'm not working calculations on this one
While Not .EOF 'starting my loop (supposedly...
.MoveNext ' going to my first 'real' data value (Note: Record X is current
curInter = 0 'reset curInte
.MovePrevious
previnter = !inter 'put (X-1) value of 'inter' field to previnte
.MoveNex
.MoveNex
nextCumArm = !CumArm 'put (X+1) value of CumArm to nextCumAr
.MovePreviou
If previnter + !CumArm + nextCumArm > 12 Then 'start making decisions - if TRUE then start putting from arm into cas
curInter =
curToCase = previnter + !CumAr
cur6s = Int(curToCase / 6
cur2s = Int((curToCase - cur6s * 6) / 2
cur1s = curToCase - 6 * cur6s - 2 * cur2
Else: curInter = previnter + !CumArm 'since it's not TRUE then continue to accummulate into ar
curToCase =
cur6s =
cur2s =
cur1s =
End I
.Edit 'time to start updating the recordset to the held variable value
!inter = curInte
!tocase = curToCas
![6s] = cur6
![2s] = cur2
![1s] = cur1
.Update 'time to move the values from the recordset to the datatabl
.Clos
Wend 'supposedly to go back to the WHILE NOT star
End Wit
Set dbs = Nothin
End Su
I'm dizzy. I really appreciate any help offered, even links to informative sites. The odd thing is that I have checked out is ng and it seems (to me, anyway) that I'm following the demonstrated examples
Thank you in advance
Derek