move object with vba

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top