Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: move object with vba

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

move object with vba
Ken 21.09.2006 17:03:01
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
RE: move object with vba
Barry Gilbert 21.09.2006 17:34:01
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

"Ken" wrote:

[Quoted Text]
> 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
Re: move object with vba
fredg <fgutkind[ at ]example.invalid> 21.09.2006 17:39:28
On Thu, 21 Sep 2006 10:03:01 -0700, Ken wrote:

[Quoted Text]
> 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.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
RE: move object with vba
Ken 21.09.2006 18:05:02
Thanks Tons! I forgot all about that.

"Ken" wrote:

[Quoted Text]
> 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

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net