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
|hit enter key to run macro||13||23|
|Field Properties in the DB Vs Bound Control on the form||9||27|
|Unhide very hidden sheets with password||22||43|
|VBA: Insert new column and remove first character of string||5||19|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
16 Experts available now in Live!