plateriot
plateriot

Reputation: 431

Access 2010 Moving a subform programatically using TOP property

Depending on a condition, I'd like a subform to move. It involves hiding another subform and moving this subform in it's place. I notice that in the first condition, it isn't necessary to define TOP as it automatically keeps this setting. But no matter how I set the TOP property in the ELSE condition, the subform just moves to the top, disregarding any fine tuning. How exactly can this be done?

Exact code is as follows (ReturnsRecords is just a function that returns true or false depending on if it returns records)

If ReturnsRecords("SELECT DISTR_ID From tbl_SP WHERE distr_id = " & Me!DISTR_ID) Then

            'Form_DISTRO.sfm_AFP_SPLIT.Top = 3.0417

            AdjustDistro "AFP", cLatest


        Else
            Form_DISTRO.sfAFP.Visible = False
            Form_DISTRO.sfm_AFP_SPLIT.Top = 1.2292
            MsgBox "Please enter a spend plan before adjusting this distribution", vbInformation


        End If

Upvotes: 0

Views: 126

Answers (1)

Jeffrey
Jeffrey

Reputation: 538

It looks like you are trying to use inches in your code. VBA uses twips when placing controls, try using 1770 instead of 1.2292.

Upvotes: 1

Related Questions