We are keeping some SKU or product lines around 45,000 in the product table now updating prices line by is very cumbersome and time consuming, and so I'm compelled to building a split form which shows all the products with the listed controls and commands:
(1) Percentage Change (This is where the percentage price change will be inserted)
(2) Check Action (Checking this box means all the products lines will be selected)
(3) The Run update Here (This command is used to take into account percentage change and increase all checked Product and prices by the same percentage)
(4) Refresh Data (This data is meant to reflect the new changes on the same screen)
Problem area
(1) Running the command does to increase the prices
(2) Check Action does not allow to deselect if some products are not required to have the price increase
VBA Code
(1) Percentage Change (This is where the percentage price change will be inserted)
(2) Check Action (Checking this box means all the products lines will be selected)
(3) The Run update Here (This command is used to take into account percentage change and increase all checked Product and prices by the same percentage)
(4) Refresh Data (This data is meant to reflect the new changes on the same screen)
Problem area
(1) Running the command does to increase the prices
(2) Check Action does not allow to deselect if some products are not required to have the price increase
VBA Code
Code:
Option Compare Database
Option Explicit
Private Sub CheckStatus_Click()
Dim strSQL As String
'make sure any unsaved changes are saved to avoid conflicts:
DoCmd.RunCommand (acCmdSaveRecord)
'build the update query SQL string:
strSQL = "UPDATE [tblProducts]" _
& " SET [Sales]=Not NZ([Sales],0)"
'if the form has an active filter - include it:
If Me.Filter <> "" And Me.FilterOn = True Then
strSQL = strSQL & " WHERE " & Me.Filter
End If
'run the update query SQL string:
CurrentDb.Execute strSQL
'refresh the form so that changes in the table "bubble-up" to the form:
Me.Refresh
exit_sub:
End Sub