Question : Code works fine in debug mode, but not at run time

In a split form, I am making a button visible/invisible based on some criteria in the form_current event. If I debug the form_current event, the control becomes visible or invisible correctly.

Say for eg., For my first record, if the button is visible, then it is still visible if I go to any of the other records in the split form Datasheet.

Answer : Code works fine in debug mode, but not at run time

Just done some googling on this and the problem is common.
The workaround, which I've just confirmed is not to use Me as the object but to reference the form directly.

So in the current event you can do..

dim frm as form
set frm = forms!thisformnamehere
if frm.fieldname = "yyy" then
frm.buttonname.visible = true
else
frm.buttonname.visible = false
end
Random Solutions  
 
programming4us programming4us