How to programmatically ....

  • Thread starter Thread starter Alain
  • Start date Start date
A

Alain

Hi to All,

Is it possible to programmatically set the position of a control on a
report, I need a control (text box) to either to move up or down depending
on a criteria of another control.
I have tried the following:
text15.top = 1.5

and it give me the following error 2102 the setting you entered is not valid
for this property, I also tried
text15.top = 1.5"
and it gives me an end of statement error

So can anyone tell me what I am doing wrong

thanks

Alain
 
The Left, Top, Width and Height properties must be entered in Twips where 1"
= 1440 Twips.
text15.top = 2160
 
The value of this property is in twips, and there are 1440 twips to an inch,
so a setting of 1.5 would not be noticeable to the naked eye. Not sure why
you would get an error message with that first example, though. The property
is an integer, but in my tests it did not complain if I passed a fractional
number, it just implicitly converted it. Anyhow, here's an example that
works - provided the depth of the detail section is great enough to
accomodate the control in the lower position.

'Used this to find the original value (15) ...
'Debug.Print ShippedDate.Top

If (LineNumber Mod 2) = 0 Then
ShippedDate.Top = 60
Else
ShippedDate.Top = 15
End If


--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
I just tried it and it still give me the same error "2102 the setting you
entered is not valid for this property"
is there a setting that I need to change somewhere?

Thanks
 
Try posting the complete line of code that is raising the error, and also
tell us in which event procedure you are trying to execute this code. It
should work in the Format event of the Detail section.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Hi Brendan,

here is the complete sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'repositionnement des champs si SplitVC = 0
If Nz(Me.SplitVc, 0) = 0 Then
Text727.Top = 1860
End If
End Sub

Alain
 
I think you have two problems:
1. Change If Nz(Me.SplitVc, 0) = 0 Then to If Me.SplitVc = 0 Then
2. You can't change the Top property in the Print event. Try using the
Format event.
 
Alain said:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'repositionnement des champs si SplitVC = 0
If Nz(Me.SplitVc, 0) = 0 Then
Text727.Top = 1860
End If
End Sub


You can not move controls around in the Print event.

Use the Format event for making formatting changes.
 
Back
Top