move object with vba

K

Ken

I wrote some code to move a line object "on timer" it dissappears, and doesnt
produce an error. the code is below (some lines commented because they were
just to see) and the timer is set to 1000.

Is it even possible to move or resize a control?

Select Case CDbl(Right(Time$, 2)) * 5
Case Is < 90
Me!second.Left = 8.5
Debug.Print Abs(Cos(CDbl(Right(Time$, 2)) * 5))
Debug.Print Abs(Sin(CDbl(Right(Time$, 2)) * 5))
Debug.Print CDbl(Right(Time$, 2))
Debug.Print Abs(Sin(CDbl(Right(Time$, 2)) * 5)) + 3
'Me!second.Visible = 0
Me!second.Width = Abs(Cos(CDbl(Right(Time$, 2)) * 5))
Me!second.Height = Abs(Sin(CDbl(Right(Time$, 2)) * 5))
Me!second.Top = Abs(Sin(CDbl(Right(Time$, 2)) * 5)) + 3
'Me!second.LineSlant = 0
'DoCmd.RepaintObject acForm, "addressbook"

End Select
 
B

Barry Gilbert

Your values need to be converted to twips. Mulitply everything by 1440, like
this:

Me!second.Width = Abs(Cos(CDbl(Right(Time$, 2)) * 5)) * 1440

Barry
 
F

fredg

I wrote some code to move a line object "on timer" it dissappears, and doesnt
produce an error. the code is below (some lines commented because they were
just to see) and the timer is set to 1000.

Is it even possible to move or resize a control?

Select Case CDbl(Right(Time$, 2)) * 5
Case Is < 90
Me!second.Left = 8.5
Debug.Print Abs(Cos(CDbl(Right(Time$, 2)) * 5))
Debug.Print Abs(Sin(CDbl(Right(Time$, 2)) * 5))
Debug.Print CDbl(Right(Time$, 2))
Debug.Print Abs(Sin(CDbl(Right(Time$, 2)) * 5)) + 3
'Me!second.Visible = 0
Me!second.Width = Abs(Cos(CDbl(Right(Time$, 2)) * 5))
Me!second.Height = Abs(Sin(CDbl(Right(Time$, 2)) * 5))
Me!second.Top = Abs(Sin(CDbl(Right(Time$, 2)) * 5)) + 3
'Me!second.LineSlant = 0
'DoCmd.RepaintObject acForm, "addressbook"

End Select

All measurements must be in Twips (1440 per inch).
So using Me!second.Left = 8.5
would position the control at 8.5 Twips from the left, which would not
be observable to the human eye.
Me!second.Left = 8.5 * 1440 wound position the control 8.5 inches from
the left. Is that where you wanted it?
Adjust all measurements accordingly.
 
Top