Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

move a control in the detail.print event in a report 1

Status
Not open for further replies.

bakershawnm

Programmer
Apr 18, 2007
84
0
0
US
I have been searching for a couple of days and have not found anything that tells me I cannot do this. However I have not found anything that tells me I can either.

I am using Access 2007. I am drawing a series of circles on a form using the detail.print event. with those circles I need 2 labels with each. I have the labels hidden on the report. I can move them initially in the report.load event but the locations of the circles may change with each record. I need the labels to move when the circles move.

What ever I try I get the 2101 error "The setting you entered isn't valid for this property".

I have tried calling the .load event from the detail.print event but that doesn't work.

I tried setting the Left and Top properties inside the .print event but got the error. This is actually the same code that is in the .Load event and it work there.

pincntrl = "Label" & (266 + x)
Me(pincntrl).Left = (pinHCtr + sngRadius)
Me(pincntrl).Top = (pinVCtr - (250 + sngRadius))

I then tried using the control.move function, got the error.

pincntrl = "Label" & (266 + x)
Me(pincntrl).move (pinHCtr + sngRadius), (pinVCtr - (250 + sngRadius))

I thought maybe it was the way I was referencing the control so I tried this instead. ll and lt are dim'd as variants

For Each c In Me.Controls
If c.Name = "Label" & 266 + x Then
ll = (pinHCtr + sngRadius)
lt = (pinVCtr - (250 + sngRadius))
c.move ll, lt
End If
Next

So I thought maybe based on this


that maybe I should try this

For Each c In Me.Controls
If c.Name = "Label" & 266 + x Then
ll = (pinHCtr + sngRadius)
lt = (pinVCtr - (250 + sngRadius))
call movecntrl(c, ll, lt)
End If
Next


Sub movecontrol(ByVal cntrl As Object, ByVal Lft As Variant, ByVal Tp As Variant)
cntrl.Move Lft, Tp
End Sub

Still got the 2101 error.

Am I being an idiot on this and trying to do something that is impossible? Or am approaching this from the wrong perspective?


Thanks in advance for any help.

shawn
 
Use the older format event (must view in print preview). I am not sure why that is but the newer paint event does not support movement. I am guessing it is to late to move a control by the time the event fires.
 
This worked beautifully because I am not concerned about Report view as everything on this project is either in print preview or printed to a PDF.

Have a star.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top