Hi all,
Well, I've been banging my head against the wall on this one for quite some time now, and now am asking for some assistance.
I have a form that contains two subforms. I have this code, which is working properly for the first tabbed subform (on a tab control), but gives me an error when the same code is used to reference the 2nd subform on the 2nd tab.
Here is the code:
The error i get is a run-time error '2465', telling me that it cannot find the referenced field "SF_ProductionScheduleExtras". Obviously this appears to just be a referencing issue, but I cannot figure out why. I'm wondering if it's a focus issue? It has worked great for the other subform control that I originally wrote it for.
Thanks for any help you can provide!
Erik
Well, I've been banging my head against the wall on this one for quite some time now, and now am asking for some assistance.
I have a form that contains two subforms. I have this code, which is working properly for the first tabbed subform (on a tab control), but gives me an error when the same code is used to reference the 2nd subform on the 2nd tab.
Here is the code:
Code:
Option Compare Database
Sub expandBatch()
' Function to expand multiquantity records (in Batch) into Qty = 1 records in SNL for a given batch.
'--- EXPAND FOR EXTRAS ---
Dim counter As Integer ' this will hold the initial Qty for each record in Batch
Dim db As DAO.Database
Set db = CurrentDb
Dim rstPSE As DAO.Recordset
Dim rstBatch As DAO.Recordset
Set rstPSE = db.OpenRecordset("dbo_T_ProductionScheduleExtras", dbOpenDynaset, dbSeeChanges)
[B]Set rstBatch = Forms![F_ScheduleGenerator]![SF_ProductionScheduleExtras].Form.RecordsetClone[/B]
With rstBatch
.MoveFirst
Do Until .EOF
counter = !QtyOrdSell
Do While counter > 0
rstPSE.AddNew
rstPSE!BuildDate = rstBatch!ReqShipDate
rstPSE!TransID = rstBatch!TransID
rstPSE!ItemId = rstBatch!ItemId
rstPSE!CustName = rstBatch!CustName
rstPSE!Model = rstBatch!ModelDesc
rstPSE!Volt = rstBatch!Volt
rstPSE!Phase = rstBatch!Phase
rstPSE!Options = rstBatch![cf_Option Values]
rstPSE!CustName = rstBatch!CustName
rstPSE!CustPO = rstBatch!CustPONum
rstPSE.Update
Debug.Print counter
counter = counter - 1
Loop 'counter decrementing
rstBatch.MoveNext
Debug.Print "next record in Batch"
Loop ' on .eof
End With
rstBatch.Close
rstPSE.Close
Set rstBatch = Nothing
Set rstPSE = Nothing
End Sub
Thanks for any help you can provide!
Erik