selam, bi rapor dosyasında tablo kullanmak istiyorum. fakat ayrıntı kısmında dikini bir çizgi koyduğum zaman eğer burdaki metin uzunsa çizgi kısa kalıyor. bu çizgiyi satır sayısına göre nasıl uzatabilirim
Aşağıdaki kodu raporunuzun kod kısmına yerleştirin bütün verileriniz çerçeve içine girer yani tablo görüntüsünde olur..
Option Explicit
Private Type udtPrtMips_str
strRGB As String * 28
End Type
' Structure from ADH97
Private Type udtPrtMips
lngLeft As Long
lngTop As Long
lngRight As Long
lngBottom As Long
lngDataOnly As Long
lngWidth As Long
lngHeight As Long
lngDefaultSize As Long
lngItemsAcross As Long
lngColumnSpacing As Long
lngRowSpacing As Long
lngItemLayout As Long
lngFastPrinting As Long
lngDataSheet As Long
End Type
' Track where Detail Section Ends
' so we can Draw Grid to fill in
' down the rest of the page
Dim intDetailEnds As Integer
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
' How thick our Line will be
Me.DrawWidth = 4
' Set ScaleMode = Twips
Me.ScaleMode = 1
' Print Border Line at bottom of this Section
Me.Line (0, Me.Height)-(Me.Width, Me.Height)
' For Debugging
' Print out the values of Me.Top and Me.Height
'Me.CurrentX = 1440
'Me.CurrentY = Me.Height - 180
'Me.Print Me.Top + Me.Height
' Let's keep track of the bottom of the
' last row/the bottom of the Detail section
intDetailEnds = Me.Top + Me.Height
'Debug.Print "intDetailEnds:" & intDetailEnds & " Me.Top:" & Me.Top & " Me.Height:" & Me.Height & " " & Me.customerID
End Sub
Private Sub Report_Activate()
DoCmd.Maximize
End Sub
Private Sub Report_Page()
Const TWIPSPERINCH = 1440
' Offset from right edge of Control where our
' Vertical Line will start - adjust as you desire.
' Expressed in Twips
Dim intLineMargin As Integer
' Need Control object to loop through Control Collection
Dim CtlDetail As Control
' Y position where we will start Drawing our Grid from
Dim startY As Integer
' Var will be set to the Margin you
' set for the Bottom of the Page
' and Top of the Page via
' the Page Setup Menu
' Expressed in TWIPS.
Dim varBMargin As Variant
Dim varTMargin As Variant
' PrtMips structs
Dim MIPSstr As udtPrtMips_str
Dim MIPS As udtPrtMips
' See Access help for PrtMip
MIPSstr.strRGB = Me.PrtMip
LSet MIPS = MIPSstr
' Copy value into our page Margin vars
varBMargin = MIPS.lngBottom
varTMargin = MIPS.lngTop
' intLineMargin is expressed in TWIPS
intLineMargin = 60
' How thick our Line will be
Me.DrawWidth = 4
' We need to draw a vertical line at the left
' edge of our report. All other vertical lines are to the
' right edge of the existing controls
' You should place the right most control at the extreme
' right edge of your report - intMargin
With Me
Me.Line ((0), .Section(acPageHeader).Height) _
-(0, .ScaleHeight - _
(.Section(acPageFooter).Height))
End With
' OK lets draw a vertical line to seperate each field
' for each control in details control
For Each CtlDetail In Me.Section(acDetail).Controls
' Don't draw a Vertical line at end of Horizontal Line control - not needed
If Not TypeOf CtlDetail Is Access.Line Then
With CtlDetail
Me.Line ((.Left + .Width + intLineMargin), Me.Section(acPageHeader).Height) _
-(.Left + .Width + intLineMargin, Me.ScaleHeight - _
(Me.Section(acPageFooter).Height))
End With
End If
Next
' If there is still room between where Detail Section ends
' and the Top of the Page Footer Section begins.
If intDetailEnds < (Me.ScaleHeight + varBMargin) - (Me.Section(acPageFooter).Height) Then
' Draw our Horizontal Lines
' Start at Bottom of last Detail Section
' We must subtract Top Page Margin
startY = intDetailEnds - varTMargin
' Let's fill in the rest of the this blank space with a Grid
' equal in height to the Detail Section.
With Me
Do While startY <= (.ScaleHeight + varBMargin) - ((.Section(acPageFooter).Height) + .Section(acDetail).Height)
Me.Line (0, startY)-(.Width, startY)
'Debug.Print "StartY:" & startY & " Detail Section Height:" & .Section(acDetail).Height
'Me.CurrentX = 1440
'Me.CurrentY = startY
'Me.Print startY
' Increase by height of Detail Section
' You can use whatever value you want for the Grid Height
startY = startY + .Section(acDetail).Height
Loop
End With
End If
Eğer sadece dikine çizgi isterseniz de aşağıdaki kodu deneyiniz..
Option Explicit
Private Type udtPrtMips_str
strRGB As String * 28
End Type
' Structure from ADH97
Private Type udtPrtMips
lngLeft As Long
lngTop As Long
lngRight As Long
lngBottom As Long
lngDataOnly As Long
lngWidth As Long
lngHeight As Long
lngDefaultSize As Long
lngItemsAcross As Long
lngColumnSpacing As Long
lngRowSpacing As Long
lngItemLayout As Long
lngFastPrinting As Long
lngDataSheet As Long
End Type
Private Sub PageHeader_Print(Cancel As Integer, PrintCount As Integer)
With Me
' Let's Draw a border around the Section as well
' We could do simply code like:
'Me.Line (0, 0)-Step(.Width, .Height), 0, B
' But let's do it in individual line segments
' in case you need to draw/not draw these segments
Me.Line (0, 0)-(.Width, 0)
Me.Line (0, .Height)-(.Width, .Height)
Me.Line (0, 0)-(0, .Height)
Me.Line (.Width, 0)-(.Width, .Height)
End With
End Sub
Private Sub Report_Activate()
DoCmd.Maximize
End Sub
Private Sub Report_Page()
Const TWIPSPERINCH = 1440
' Offset from right edge of Control where our
' Vertical Line will start - adjust as you desire.
' Expressed in Twips
Dim intLineMargin As Integer
' Need Control object to loop through Control Collection
Dim CtlDetail As Control
' Y position where we will start Drawing our Grid from
Dim startY As Integer
' Var will be set to the Margin you
' set for the Bottom of the Page
' and Top of the Page via
' the Page Setup Menu
' Expressed in TWIPS.
Dim varBMargin As Variant
Dim varTMargin As Variant
' PrtMips structs
Dim MIPSstr As udtPrtMips_str
Dim MIPS As udtPrtMips
' See Access help for PrtMip
MIPSstr.strRGB = Me.PrtMip
LSet MIPS = MIPSstr
' Copy value into our page Margin vars
varBMargin = MIPS.lngBottom
varTMargin = MIPS.lngTop
'intLineMargin is expressed in TWIPS
intLineMargin = 20
' We need to draw a vertical line at the left and right
' edge of our report. All other vertical lines are to the
' right edge of the existing controls
' You should place the right most control at the extreme
' right edge of your report - intMargin
' Draw Line Left Edge
With Me
' Won't take 0 for the starting Y param - use 1.
Me.Line ((0), 1)-(0, .ScaleHeight - _
(.Section(acPageFooter).Height))
End With
' OK lets draw a vertical line to seperate each field
' for each control in details control
For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail
If Page = 1 Then
Me.Line ((.Left + .Width + intLineMargin), 1 + Me.Section(acHeader).Height) _
-(.Left + .Width + intLineMargin, Me.ScaleHeight - (Me.Section(acPageFooter).Height))
Else
Me.Line ((.Left + .Width + intLineMargin), 1) _
-(.Left + .Width + intLineMargin, Me.ScaleHeight - (Me.Section(acPageFooter).Height))
End If
End With
Next
'CleanUp time
Set CtlDetail = Nothing
End Sub
Private Sub ReportHeader_Print(Cancel As Integer, PrintCount As Integer)
With Me
' Let's Draw a border around the Section as well
' We could do simply code like:
'Me.Line (0, 0)-Step(.Width, .Height), 0, B
' But let's do it in individual line segments
' in case you need to draw/not draw these segments
Me.Line (0, 0)-(.Width, 0)
Me.Line (0, .Height)-(.Width, .Height)
Me.Line (0, 0)-(0, .Height)
Me.Line (.Width, 0)-(.Width, .Height)
End With
End Sub
güzel kod...fakat bişi soracam acaba şöyle bişe yapabilirmiyiz, ayrıntı kısmında normalde gelen ver verinin yüksekliği farklı oluyor ve bu yüzden dikey çizgi kısa kalabiliyor, bu çizginin boyunu gelen veriye göre nasıl ayarlayabiliriz. Örneğin;
cizgi.Height=aciklama.Height gibi birşey kullanmam lazım
Sorunuzu anlamakta güçlük çekiyorum, nasıl bir rapor tasarımınız var ? Yukarıdaki kodlarla da yapabilirsiniz ya da en iyisi raporunuzu görmek lazım
Ben yine tam anlamadım kanımca
Size tavsiyem ise dikey çizgi çekeceğiniz alan için 1 ya da 2 tane metin kutusu yapın be bu kutulara aynı alan ismini verin sonra bu kutuların çizgi rengi, arka rengi saydam beyaz ya da siyah yaparak ve boyutlarıyla oynuyarak ve tabii üste getir alta getir özelliklerini de katarak bunları üst üste bindirin ve istediğiniz sonucu alıncaya dek uğraşın. Ayrıca bu metin kutularının büyüyebilir özelliklerini evet olarak ayarlayın..
bir modül oluştur
Public Sub MakeBoxesGrow(ThisReport As Report)
Dim X1 As Single
Dim X2 As Single
Dim Y1 As Single
Dim Y2 As Single
Dim Offset As Single
Dim Color As Long
Dim ThisControl As Control
Dim MaxHeight As Single
For Each ThisControl In ThisReport.Section(acDetail).Controls
If ThisControl.Visible = True Then
If ThisControl.Height > MaxHeight Then
MaxHeight = ThisControl.Height
End If
End If
Next ThisControl
Sizlere daha iyi bir deneyim sunabilmek icin sitemizde çerez konumlandırmaktayız, web sitemizi kullanmaya devam ettiğinizde çerezler ile toplanan kişisel verileriniz Veri Politikamız / Bilgilendirmelerimizde belirtilen amaçlar ve yöntemlerle mevzuatına uygun olarak kullanılacaktır.