Controlling Top Property with VBA (1 Viewer)

Reese

Registered User.
Local time
Today, 07:40
Joined
Jan 13, 2013
Messages
387
I have a form that I would like to set an On_Current event that changes the location of various controls based on an If/Then statement. I thought that just using Me.ControlName.Top would work but instead of setting the control's top to the desired location, it sends it to the very top of the form.

Here is what I have so far:

Code:
Private Sub Form_Current()

If Date = #4/1/2016# Then
    Me.Box1.Top = "5.6563"
    Me.Girl.Visible = True
Else
    Me.Box1.Top = "2.2917"
    Me.Girl.Visible = False
End If

End Sub
This is just for an April Fools joke, so if it requires a lot of crazy coding I'm not super invested in it. The objective is to change the database's opening form to replace the standard label and logo with a picture of a creepy girl on April 1st. The problem is that the picture is larger than the usual title label and logo, so I have to lower everything else to make room.

Any ideas?
 
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 12:40
Joined
Feb 19, 2013
Messages
16,670
the location properties are measured in twips - 567=1cm, 1440=1 inch - and it is a number, not text

Me.Box1.Top = 5.6563 *567 (if cm)

you can also make it fit by changing height and width properties and setting the image to zoom.
 

Reese

Registered User.
Local time
Today, 07:40
Joined
Jan 13, 2013
Messages
387
Thanks CJ, that was the answer I needed!
 

Users who are viewing this thread

Top Bottom