Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.
Private Sub Command34_Click() 'DoCmd.SetWarnings False If Not (Recordset.EOF And Recordset.BOF) Then Recordset.MoveFirst 'Good habit Do Until Recordset.EOF = True DoCmd.OpenQuery "qryStockTransferDeductFrom" ' Deducts the quantity from QtyLoc in the ProdLocations Table. If DCount("*", "[ProdLocations]", "[ProductID] =" & Me.ProductID & " AND [LocID] =" & Me.LocID) > 0 Then DoCmd.OpenQuery "qryStockTransferAddTo" 'Updates QtyLoc in the ProdLocations Table If there is one already existing from the Dcount. Else DoCmd.OpenQuery "qryStockTransferAddAppend" 'Adds a record to ProdLocations Table if one doesn't already exist from the Dcount. 'Move to the next record. Don't ever forget to do this. Recordset.MoveNext Loop Else MsgBox "There are no records in the recordset." End If End If MsgBox "Finished looping through records." 'Recordset.Close 'Close the recordset 'Set Recordset = Nothing 'Clean up 'DoCmd.SetWarnings True End Sub