Hi!
I am trying to work out a bit of code which I can put on a button which will set every record in a column to 0 if certain criteria are met.
Example: The table has 24 columns - Named Month01 to Month24. I have made a continuous form with a button showing each of the month names. When I click on the button "Month01" I want every record to have the value in Month01 to change to 0... ALMOST!
There is an added twist in that I have 3 different "Parts" to my database. The form with the buttons is already filtered for "Part1", say, so I want every Part1 record have the value in Month01 change to 0.
Is this possible?
I tried being clever with sql, but it didn't work:
CurrentDb.Execute "Update TblMonth Set TblMonth." & Me.MonthNumber & " = 0 Where TblMonth.Part = " & DLookup("[PartNumber]", "[TblPartCurrent]")
Am I on the right track or miles off?!
Thanks!
I am trying to work out a bit of code which I can put on a button which will set every record in a column to 0 if certain criteria are met.
Example: The table has 24 columns - Named Month01 to Month24. I have made a continuous form with a button showing each of the month names. When I click on the button "Month01" I want every record to have the value in Month01 to change to 0... ALMOST!
There is an added twist in that I have 3 different "Parts" to my database. The form with the buttons is already filtered for "Part1", say, so I want every Part1 record have the value in Month01 change to 0.
Is this possible?
I tried being clever with sql, but it didn't work:
CurrentDb.Execute "Update TblMonth Set TblMonth." & Me.MonthNumber & " = 0 Where TblMonth.Part = " & DLookup("[PartNumber]", "[TblPartCurrent]")
Am I on the right track or miles off?!
Thanks!