vbams-accessms-access-2016

Cannot set MS Access options group position to correct value


I have the following, seemingly trivial, VBA code:

ctrl.Top = offset

ctrl is an options group control on a form. offset is an integer variable. I am using the debugger to step through the code line by line. Using watches, I observe the following values:

Before the line of code:

ctrl.Top: 3670
offset: 4170

After the line of code:

ctrl.Top: 3820
offset: 4170

I have tried the following:

At first I thought that ctrl.Top might have some kind of limit, but the last test suggests otherwise. Is there any mechanism, layout, restriction or anything that could cause such a behavior? I honestly don't even know where to start looking.


Solution

  • I was able to eventually figure out what the problem was. As I mentioned in the question, the control is an options group control. Naturally, that group contains buttons to select an option. As it turns out, moving an option group will not move its contents along and you are not allowed to move the group past it's content. So any attempt to move the options group past the option buttons resulted in the position getting clipped.