I'm using VBA to dynamically add rows of textboxes to a Report, then
assign values to those textboxes. The values are definitely being
assigned as I can MsgBox them afterward and the values come up, but
they are NOT actually showing on the Report. Here's the code:
Private Sub Command0_Click( )
Dim NewTextBox As TextBox
DoCmd.OpenRepor t "UserReport ", acViewDesign
X = 1
BoxTop = 480
NextRow = 420
For r = #7/30/2008# To #8/7/2008#
'Day
Set NewTextBox =
Controls.Applic ation.CreateRep ortControl("Use rReport", acTextBox)
With NewTextBox
.Name = "Day" & X
.Top = BoxTop
.Left = 120
.Width = 540
.Height = 300
.FontSize = 10
.FontName = "Arial"
.BorderStyle = fmBorderStyleSi ngle
.SpecialEffect = fmSpecialEffect Flat
End With
X = X + 1
BoxTop = BoxTop + NextRow
Next r
DoCmd.OpenRepor t "UserReport ", acViewPreview
Y = 1
For r = #7/30/2008# To #8/7/2008#
ThsWkDy = Weekday(r)
Select Case (ThsWkDy)
Case 1
WkDy = "SUN"
Case 2
WkDy = "MON"
Case 3
WkDy = "TUE"
Case 4
WkDy = "WED"
Case 5
WkDy = "THU"
Case 6
WkDy = "FRI"
Case 7
WkDy = "SAT"
End Select
Reports("UserRe port")("Day" & Y) = WkDy
Y = Y + 1
Next r
End Sub
The form comes up in Print Preview showing ONLY the Labels I've saved
it with for headers. How do I get the assigned values to show??
assign values to those textboxes. The values are definitely being
assigned as I can MsgBox them afterward and the values come up, but
they are NOT actually showing on the Report. Here's the code:
Private Sub Command0_Click( )
Dim NewTextBox As TextBox
DoCmd.OpenRepor t "UserReport ", acViewDesign
X = 1
BoxTop = 480
NextRow = 420
For r = #7/30/2008# To #8/7/2008#
'Day
Set NewTextBox =
Controls.Applic ation.CreateRep ortControl("Use rReport", acTextBox)
With NewTextBox
.Name = "Day" & X
.Top = BoxTop
.Left = 120
.Width = 540
.Height = 300
.FontSize = 10
.FontName = "Arial"
.BorderStyle = fmBorderStyleSi ngle
.SpecialEffect = fmSpecialEffect Flat
End With
X = X + 1
BoxTop = BoxTop + NextRow
Next r
DoCmd.OpenRepor t "UserReport ", acViewPreview
Y = 1
For r = #7/30/2008# To #8/7/2008#
ThsWkDy = Weekday(r)
Select Case (ThsWkDy)
Case 1
WkDy = "SUN"
Case 2
WkDy = "MON"
Case 3
WkDy = "TUE"
Case 4
WkDy = "WED"
Case 5
WkDy = "THU"
Case 6
WkDy = "FRI"
Case 7
WkDy = "SAT"
End Select
Reports("UserRe port")("Day" & Y) = WkDy
Y = Y + 1
Next r
End Sub
The form comes up in Print Preview showing ONLY the Labels I've saved
it with for headers. How do I get the assigned values to show??
Comment