vba - Toggle Button to Alternate Multipliers (Access) -
my access db helps users process timecards , prepare payroll , invoices. part of process involves taking hours generated workers , attaching rate hours billing purposes. based on current headcount, there can 2 different bill rates need applied hours.
i using toggle button (named tglhcflag) user specify billing rate wish use. being done because billable headcount must specified user @ time of processing , cannot calculated data.
there table (tblrates) contains rates each state of toggle button. want save value selected user toggle button access can 'remember' last rate used user in table (defaultmarkup field). value used set state of button on form load because wont change , more of convenience user.
private sub form_load() me.tglhcflag.value = dlookup("defaultmarkup", "tblrates") end sub
and
private sub tglhcflag_click() docmd.setwarnings false if me.tglhcflag.caption = "using 50+ markup" me.tglhcflag.caption = "using < 50 markup" docmd.runsql "update tblrates set defaultmarkup = ""true""" else me.tglhcflag.caption = "using 50+ markup" docmd.runsql "update tblrates set defaultmarkup = ""false""" end if docmd.setwarnings true end sub
the problem every time after first or second click (sometimes first , second) of toggle button, access yells @ me: "the data has been changed. user edited record , saved changes before attempted save changes. re-edit record."
what doing wrong?
Comments
Post a Comment