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!

Dynamically change the placement of control(s) on a report

Status
Not open for further replies.

dlstapleford

Programmer
Dec 11, 2002
14
0
0
US
Does anyone know a way to dynamically change the placement of control(s) on a report based on data from the report source?

For instance, if the field “Side” had the value “Right” then the textbox control “Name” would print on the right (say, at 3.75”)? If, in the next record read, the field “Side” had the value “Left” then the textbox control would move back to the left before printing.

I am attempting to visually represent a neighborhood block as viewed from above. House number 2 would show directly to the right of house number 1.
 
It will take quite a bit of VBA programing but it is do-able.
You can set and reset the me.myfield.Left property as well as the top, width and height properties to adjust position and size as needed.

Also take care and time to logically name your fields and you labels thsi will help in reducing the amount of code you need to right if you use loops and arrays to control the movment.

I've included some code to get you started, It is not quite the same thing you are doing but it is simalar enough to help I think. In this case the problem was to display data in a continous form format that was wider than the screen. the users did not want to lose focus of the descriptions on the left of the screen but want to scroll through thirteen columns of numbers to the right. (Yearly Budget) The following code moved the labels and fields and controled visiblity. Maybe this will show you some of what can happen.

Good Luck
ssecca

Private Sub Command105_Click()
Dim i As Integer


Select Case ScrollPos
Case 1 To 13
For i = 12 To ScrollPos + 1 Step -1
Me("lbl_mon" & CStr(i)).Left = Me("m" & CStr(i) & "_Dollars").Left + MoveTwips
Me("sumM" & CStr(i)).Left = Me("m" & CStr(i) & "_Dollars").Left + MoveTwips
Me("m" & CStr(i) & "_Dollars").Left = Me("m" & CStr(i) & "_Dollars").Left + MoveTwips
Next i

i = ScrollPos
Me("m" & CStr(i) & "_Dollars").Visible = True
Me("lbl_mon" & CStr(i)).Visible = True
Me("sumM" & CStr(i)).Visible = True

Case 0
'MsgBox "Can not scroll any further, Sorry"
End Select
ScrollPos = ScrollPos - 1
If ScrollPos < 0 Then ScrollPos = 0
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top