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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the "Top" Property of a control in Access Rpt

Status
Not open for further replies.

DanielleH

Programmer
Jun 5, 2001
9
US
Hi,
I am trying to set the "Top" Property of some text boxes, labels and lines in an Access report in code at runtime. I cannot seem to be able to actually change the property. In the Detail_Print area of the code, I have put:

Me.txtAcc2.Properties("Top") = 9116

I tried a few different things and looking through help but I can't seem to get it. I am thinking there is a simple answer but I am pulling my hair out trying to get it. Any help is greatly appreciated! :eek:)
 
i though to set the top property it would be

Me.txtAcc2.Top = 9116

also when the report runs wouldnt it work by putting it under the on open event ?

i havent got a printer set up on my machine so cant access reports feature at the moment so hope the above helps

Chance



 
It must be the code I have surrounding it. You see, I want to reset the "Top" property of some controls if the value of a text box is Null. I can't ascertain the value of the text box unless it is in the Detail_Print event. So, what you suggested about putting that particular statement in the Report_Open event works, however, I won't know the value of the text box unless it is in the Detail_Print event. Here's my code, it may clear some things up:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me.txtAcc1SpRep <= 0 Then
Me.lblAcc1SpRep.Visible = False
Me.txtAcc1SpRep.Visible = False
Me.lblAcc1Ahead.Visible = False
If IsNull(Me.txtAcc2Product) Then
Me.Line1Acc2.Top = 9116 '**
Me.lblAcc2Num.Top = Me.Line1Acc2.Top + 56.7
End If
End If
End Sub

'** When it gets to this line, the following error appears: &quot;Run-time error 2101: The setting you entered isn't valid for this property. To see the valid settings for this property, search the Help index for the name of the property&quot;
Which is weird because the same statement &quot;Me.Line1Acc2.Top = 9116&quot; works in the Report_Open event. I'll keep having a look at it! :eek:)
 
I want to reset the &quot;Top&quot; property of some controls if the value of a text box is Null. I can't ascertain the value of the text box unless it is in the Detail_Print event.

The value of a text box is the default value, otherwise read with the .Text property. I'm not sure why you can only find this value at certain times, maybe I don't understand?

Me.Line1Acc2.Top = 9116

Lines don't have Tops. You can set/read X1 and X2 instead.
 
I seemed to have worked things out, thanks anyway! Probably too long-winded to explain! I have had to do things a weird way due to the weird design of the database.
If you draw a line control on a report and click on it, there is a &quot;Top&quot; property.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top