Hi - could use some help on what is hopefully a straightforward nomenclature issue...
I have a button on form that when clicked, updates the form's data (4 fields from Tbl_BatchRecord) into multiple transactional records (Table: Tbl_LotN) via a record set. All works great to transfer this data. However, I would also like to populate a 5th field (LotN_QtyStart) by using the value from a field (LotN_QtyPlanned) within this recordset. I am struggling on how to reference that field appropriately....
In normal text, I want to update: ![LotN_QtyStart] with the existing value in [LotN_QtyPlanned]
Note: Yes, I understand data structuring and how to not duplicate data, etc. I am doing this to pre-populate 'default' values that may be overwritten in specific transactional data sets.
I have a button on form that when clicked, updates the form's data (4 fields from Tbl_BatchRecord) into multiple transactional records (Table: Tbl_LotN) via a record set. All works great to transfer this data. However, I would also like to populate a 5th field (LotN_QtyStart) by using the value from a field (LotN_QtyPlanned) within this recordset. I am struggling on how to reference that field appropriately....
In normal text, I want to update: ![LotN_QtyStart] with the existing value in [LotN_QtyPlanned]
Code:
'Set SKU-Lot default values
Dim rs As DAO.Recordset, strsql3 As String
strsql3 = "Select * From Tbl_LotN WHERE LotN_BatchIDREF = '" & Me.BR_BatchID & "'"
Set rs = CurrentDb.OpenRecordset(strsql3)
With rs
If Not .BOF And Not .EOF Then
.MoveLast
.MoveFirst
While (Not .EOF) 'if true, we exit the while loop
If .Updatable Then
.Edit
![LotN_Lot] = xBR_BatchLot
![LotN_Expiry] = xExpiry
![LotN_BuildReason] = xBuildReason
![LotN_QtyStart] = Me.Recordset("LotN_QtyPlanned") 'HOW TO GET THIS??'
.Update
End If
.MoveNext 'otherwise in a loop
Wend
End If
.Close 'closes the recordset
End With
MsgBox "Lot Defaults Entered", vbOKOnly
ExitSub:
Set rs = Nothing
Exit Sub
ErrorHandler:
Resume ExitSub
Note: Yes, I understand data structuring and how to not duplicate data, etc. I am doing this to pre-populate 'default' values that may be overwritten in specific transactional data sets.