Skip to main content

AccessTr.neT


Formda İki Yana Yasla?

Formda İki Yana Yasla?

Çözüldü #1
Formda TextBox da ki veriyi iki yana yaslama nasıl yapılır. Konu ile ilgili raporlarda iki yana yaslama var ama onuda çözemedim hiçbir örneği çalıştıramadım. Runtime 75 hatası veriyor.
Cevapla
Çözüldü #2
Sn mavzer-as sorun yeterince açık değil, örnek çalışma yok. Başka Access dosyalarını açabiliyormusun? Saygılar...
Bilgi paylaşıldıkça çoğalır....
Her engel, yaşam koşullarınızı daha iyileştirecek bir fırsattır.


Access için her zaman lazım olacak konu başlıkları listesi


Cevapla
Çözüldü #3
PolSoft Final

Sn.Sledgeab ın çalışmasında bulunan örneklere bir göz atınız.
Kaplumbağa ya dikkat et...
Sadece  başını çıkartıp risk aldığında ilerleyebiliyor...
Cevapla
Çözüldü #4
evet örneği inceledim ama çok detaylı bana lazım olan sadece dahili olarak modül kullanarak form üstündeki text kutusuna girilen verinin iki yana yaslanması otomatik olarak.
aslında clsJustifyText modülü var yazmışlar ama ben nasıl kullanacağımı bilmiyorum. indirdiğim örneklerdede anlamak bi tarafa çalıştıramadım bile.
Kod şu şekilde:
Kod:
' *************NOTE************* '
' ****THIS IS A CLASS MODULE**** '
' ****NOT A STANDARD MODULE***** '
' *************NOTE************* '


' Class clsJustifyText

Option Compare Database
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


' Arrays to hold the info we require from
' processing the Report's Detail Event
Private lngTop() As Long
Private lngCtlLeft() As Long
Private varData() As String
Private lngHeight() As Long
Private lngCtlHeight() As Long
Private tokens() As String
Private strCtlName As String

' We need the Filenumber/handle visible to
' several subs.
Dim m_FileNumber As Integer



Public Function fJustiDirect(rpt As Report) As Boolean
'Author:        Stephen Lebans
'Date:          January 23, 2000
'Time:          11:24:05 PM
'Name:          fJustiDirect
'Version:       3.11
'Calls:         VBA Calls only
'Purpose:       To allow Fully Justified Text
'               in a standard Access TextBox control.
'               Specifically for a Bound Memo field
'               in a Report.
'Copyright:     Lebans Holdings 199 Ltd.
'Why:           I have already produced an ActiveX control
'               to allow for Fully Justified Text.
'               Unfortunately, ActiveX controls do not
'               work within the Access CanGrow/CanShrink
'               functionality available in Reports. :-(
'
'Credits:       Pedro Gil. Code to allow for International use.
'               In the interest of World Peace! :-)
'
'How it works:
'Create a TextBox control and bind it to your data field.
'Setup the control's Font, Color, and Border properties as
'would normally.
'****CHANGE THE FONT COLOR TO WHITE***********************
'We have to do this because we are going to use the
'Report Object's Print method to draw onto the TextBox control.
'By doing it this way we effectively bypass the CanGrow/CanShrink
'property problems. There is 1 caveat. Access resizes the control
'based on the current font's settings. If you increase the margin
'setting too much you are effectively reducing the area in the control
'we have available for us to draw in. Access doesn't know we are doing
'this. To get around this you can set a Font Size smaller than that
'of the TextBox control.
'


'How to Use this Function:
'The functions contained in this module must be called directly
'from the Report's Class Module.

' At the very top of your Form's Class module,
' in the General Declarations area you must declare
' as many instances of the clsJustifyText as you require.
' Obviously one instance for each Control where you want the
' output text to be fully justified.

' **Code Start General Declaration Area
'Dim Justi1 As New clsJustifyText
'Dim Justi2 As New clsJustifyText
' ** Code End


'The fRecordDetail function is called from your Report's
'Detail Print event. The only thing different from the following
'example is that you must supply the name of your MEMO control(s).
'In this example there are 2 named "txtTestmemo" and "txtTestmemo2".
'
'**********************
'Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'Call Justi1.fRecordSection(Me, txtTestmemo, PrintCount )
'Call Justi2.fRecordSectionDetail(Me, txtTestmemo2, PrintCount)
'End Sub
'**********************
'
'The final function you must call directly from your
'Report's Class Module is fJustiDirect. You will be using
'your Report's On Page event. Make it look exactly
'like the following example. You don't have to change
'anything because the only argument required is the
'Report object itself. Since we are calling the function
'directly from your Report's Class Module we can simply
'use "Me"  to refer to the Report Object.

'**********************
'Private Sub Report_Page()
'Dim myBool As Boolean
'myBool = Justi1.fJustiDirect(Me)
'myBool = Justi2.fJustiDirect(Me)
'End Sub
'**********************
'
' Finally you need to Clean up!
' We do this in the Report's Close event
'Private Sub Report_Close()
'Set Justi1 = Nothing
'Set Justi2 = Nothing
'End Sub
'
'
'That's it. I tried to make it easy to use! :-)
'
'
'Caveats:
' Poor/nonexistent Error Handling. :-(
'
' Needs autohyphenation logic to handle
' single words that do not fit on on eline.
'
'Program Logic
' I just converted the code from a Standard module
' into a Class Module to allow for
' multiple Control's on the same Report.
' The code really needs a redesign from
' scratch but it would be a lot of work.
' It works in its present incarnation and I
' want to get back to the new projects I
' am working on. :-)
'
'COPYRIGHT:
'Please feel free to use these functions in your
'own code. There are no license restrictions other
'than you cannot sell these functions by
'themselves or as part of a collection.
'
'
'Enjoy
'Stephen Lebans
'Copyright Lebans Holdings 1999 Ltd
'Email: [email protected]
'Wed site: www.lebans.com


' Let's get started!
' This is the main entry point for the function.
' Here we break up the string data we have
' recalled/stored in the array VarData().
' So first we break up the string into Tokens,
' then we print each token/word individually to allow
' us to calculate and add the correct amount
' of space to achieve full text justification.

' Remember the array varData() is filled when
' we call the fRecordDetail function from the
' Report's Detail )Print event.
'Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'Call Justi1.fRecordDetail(Me, "testmemo", PrintCount)

' intSections holds how many rows in the
' Detail Section for this current page.
Dim intSections As Integer

' If this section's KeepTogether prop causes the section to begin on
' the next page then we need to exit!
On Error Resume Next
Dim s As String
s = varData(0)
If (Len(s & vbNullString) = 0) Then Exit Function

For intSections = 0 To UBound(varData()) - 1
    'Call FTokenize to parse/break up the string
    Call fTokenize(Nz(varData(intSections), " "))
    Call fPrintData(rpt, lngTop(intSections), lngCtlLeft(intSections), _
    lngHeight(intSections), lngCtlHeight(intSections))
Next intSections

'CLEANUP
ReDim lngTop(0)
ReDim lngCtlLeft(0)
ReDim varData(0)
ReDim lngHeight(0)
ReDim lngCtlHeight(0)
End Function


Private Sub fTokenize(InputString As String)
Dim strTemp As String
Dim strChar As String
Dim X As Long

'initialize vars
ReDim tokens(0)
strTemp = ""


X = 1
Do ' While Mid(InputString, 1, 1) <> ""
    strTemp = strTemp & Mid(InputString, 1, 1)
    strChar = Mid(InputString, 1, 1)
    
    Select Case strChar
      
      
    ' Char = Space
    Case " "
    tokens(UBound(tokens)) = Trim(strTemp)
    ReDim Preserve tokens((UBound(tokens()) + 1))
    InputString = Right(InputString, Len(InputString) - 1)
    ' reset strTemp
    strTemp = ""
        
        
    ' Char = ""  zero length string = EOF
    ' We are at the end of the string.
    ' Output previous line if any.
    ' Still increase bounds on Array so that
    ' it is always 1 more than actual.
    Case ""
    If Len(strTemp) > 0 Then
    tokens(UBound(tokens)) = strTemp
    ReDim Preserve tokens((UBound(tokens()) + 1))
    End If
    
    
    ' Char = CR.
    ' Advance string pointer 2 chars for vbCrLf
    ' Output previous line if any
    ' Output blank line
    Case vbCr
    If Len(strTemp) > 0 Then
    tokens(UBound(tokens)) = Left(strTemp, Len(strTemp) - 1)
    ReDim Preserve tokens((UBound(tokens()) + 1))
    End If
    ' Add a CR to the Token array
    tokens(UBound(tokens)) = vbCrLf '"CR"
    ReDim Preserve tokens((UBound(tokens()) + 1))
    ' Advance past vbCrLf -> 2 chars
    InputString = Right(InputString, Len(InputString) - (2))
    X = X + 1
    ' reset strTemp
    strTemp = ""
    
        
    ' Char = character. Do nothing. Advance string pointer
    Case Else
    InputString = Right(InputString, Len(InputString) - 1)
    
    End Select
    'Setup as Select Case to allow for future handling of Tabs
    'and possible formatting features
    
X = X + 1
Loop While strChar <> ""

End Sub


Private Sub fPrintData(rpt, intSectionTop, intCurCtlLeft, intSectionHeight, intlngCtlHeight)

' Need to save current Report settings
Dim oldFontName As String
Dim oldFontSize As Integer
Dim oldFontBold As Integer
Dim oldFontItalic As Integer
Dim oldForeColor As Long


' OK so it's kind of messy and maybe the var names
' could be slightly more descriptive/accurate.
' Remember this grew out of one frantic
' night of programming...give me a break.
'

' Calculate Margins
Dim MIPSstr As udtPrtMips_str
Dim MIPS As udtPrtMips
Dim varBMargin As Variant
Dim varTMargin As Variant
Dim lngLineSpaceing As Long
Dim lngExtraSpace As Long
Dim lngNumWords As Long
Dim lngLineWidth As Long
Dim lngMargin As Long
Dim lngMarginTop As Long
Dim CtlCurrent As Control
Dim startY As Long

' My junk
Dim strTemp As String
Dim Ypos As Long
Dim X As Long
Dim y As Long
Dim LngRet As Long

' Is char a CR
Dim boolCR As Boolean
' Is char End of File
Dim boolEOF As Boolean

' Store heights of
' Page Header and Footer Sections
Dim lngPageFooterHeight As Long
Dim lngPageHeaderHeight As Long

Dim strLocale As String * 2

' Flag to signfify if this
' Section has been continued from
' the previous page.
Static blHasContinued As Boolean

' Counters to kep track of number of words
' we are outputting.
Static LngTokenX As Long
Dim lngNumTokens As Long


' Let's get started
' Uhh..Global Variable..strCtlName
Set CtlCurrent = rpt.Controls(strCtlName)

' Will generate error if no PageHeader
On Error Resume Next
lngPageHeaderHeight = Nz(rpt.Section(acPageHeader).Height, 0)
' Will generate error if no PageFooter
lngPageFooterHeight = Nz(rpt.Section(acPageFooter).Height, 0)

' April 15 mods to allow the use of PageHeader and PageFooter sections
' to contain JustiDirect controls
' April 16 - PageHeader and PageFooter do not support CanGrow/CanShrink

' If CtlCurrent resides in the PageHeader section then set the
' lngPageHeaderHeight var to zero.
'If CtlCurrent.Section = acPageHeader Then lngPageHeaderHeight = 0

' If CtlCurrent resides in the PageFooter section then set the
' lngPageFooterHeight var to zero.
'If CtlCurrent.Section = acPageFooter Then lngPageFooterHeight = 0



' Calculate how many words/tokens can fit on one line
' and then add justification to the space between
' the words.

' I had originally used the GetLocaleInfo API
' to calculate the page margins. Pedro Gil was
' kind enough to send me the code to
' internationalize the process.

' Get Page margins in TWIPS
MIPSstr.strRGB = rpt.PrtMip
LSet MIPS = MIPSstr
varBMargin = MIPS.lngBottom
varTMargin = MIPS.lngTop


'Save current Font settings in report
oldFontName = rpt.FontName
oldFontSize = rpt.fontsize
oldFontItalic = rpt.FontItalic
oldFontBold = rpt.FontBold
oldForeColor = rpt.ForeColor

'Copy CtlCurrent's Font settings to Reports
With CtlCurrent
rpt.FontName = .FontName

' See my post on www.deja.com
' for the logic behind this FontBold issue.
If .FontBold = 1 Then
    rpt.FontBold = True
Else:
    rpt.FontBold = False
End If

' If you need to set larger Margins then use
' one size less so that even with justified text
' we will still fit within Control's boundaries.
rpt.fontsize = .fontsize '- 1
rpt.FontItalic = .FontItalic
rpt.ForeColor = 0 'BLACK
End With

'Scale to TWIPS - just in case
rpt.ScaleMode = 1

'Set Margin
'If you set the margin too large then the text will not
'fit in the control. Remember, the control is being resized
'by Access as per it's normal printing paramters. By adding
'a margin we are reducing the area of the control we can print
'into. To get around this, decrease the size of the font
'we are using. Subtract 1 from the fontsize.
'I have left commented out code in for this purpose.

' *****WARNING*****
' Be very careful adjusting this Margin.
' If text starts to run into the Next
' section subtract one from the Font Size as
' explained in the paragraph above.
' Expressed in TWIPS
lngMargin = 12
lngMarginTop = 10
'Calculate Linespacing
' Need to allow for Margin Access leaves at bottom
' of the Control. Also Access will not print the
' very last line of a Control if there is not enough
' room for the entire character, including descender
' and its built in margin.
' Need more work on lngLineSpaceing.
lngLineSpaceing = rpt.TextHeight(" ")
' Add some FUDGE to the Factor
lngLineSpaceing = CInt(lngLineSpaceing * 1.02)
' Setup our first horizontal position
rpt.CurrentX = intCurCtlLeft + lngMargin

'****************************************************
' WARNING LOGIC FAILURE :-)
'****************************************************

' Gotcha - Must first check and see if
' intSectionTop + ctlcurrent.height fits on the page
' with room for the footer if any. If KeepTogether = YES
' then we can have a gap at the bottom of this page.
' A print Event is generated, but if you check
' the values of intSectionTop and Ctl.Height you'll
' see that it can't possibly fit in this space.
' Not even partially. THis is the difference between
' a normal willcarryover event of the last detail section row
' where the control will partially fit

' Still having trouble understand the Cutoff point as to exactly
' when Access will not use the blank space at the bottom of
' the page between the LastRow of the Detail Section and the
' Page Footer. I've set it to 2 lines of text- Let's try that.
'If rpt.ScaleHeight - lngPageFooterHeight < CtlCurrent.Height + (intSectionTop) Then
' No this seems to work all of the time
If intSectionHeight < CtlCurrent.top + lngLineSpaceing Then
Exit Sub
End If


' There is a problem when Print Previewing and
' then going directly to physical PRINTING.
' If the last Page Print Previewed produces
' a blHasContinued = TRUE condition this
' is NOT RESET for Page 1 when it is output.
If rpt.Page = 1 Then blHasContinued = False

' Not a Has Continued Section - Normal Processing
' Should always be a Negative is HasContinued =TRUE
' but sometimes it isn't..go figure! Get around it by
' setting our own FLAG -> blHasContinued
'If intSectionTop > 0 Then
If blHasContinued = False Then

    rpt.CurrentY = (intSectionTop + lngMarginTop + CtlCurrent.top) - varTMargin
    blHasContinued = False
    If rpt.CurrentY < 0 Then Exit Sub
Else:
    rpt.CurrentY = lngPageHeaderHeight + lngMarginTop
    ' init starting YPosition
    blHasContinued = True
End If

Ypos = rpt.CurrentY
'Debug.Print "YPos at top of code:" & Ypos

' Jan 24/2000
' trying to fix error that occurs if adjacent memo field
' causes a Print Event to occur for a HasContinued Area
' and really this Memo field is completely outputted
' CUrrently 1 line is printing before sub exits
' If Ypos < 0 Then Exit Sub
' PUT IT A FEW LINES ABOVE WHERE IT BELONGS
' IN TEST OF blHasCOntinued

lngNumWords = 0
X = 0

' Total number of words to output
lngNumTokens = UBound(tokens) - 1
If lngNumTokens < 0 Then Exit Sub
' Initialize temp string
strTemp = ""
  
' ***Main Loop***
' Is HasContinued Flag = True
' Then we need to finish printing from last page
If blHasContinued = True Then
    blHasContinued = False
    X = LngTokenX
End If
Do While X <= lngNumTokens
        rpt.CurrentX = intCurCtlLeft + lngMargin
        
        Do While lngLineWidth < CtlCurrent.Width - (lngMargin * 2)
            If lngNumWords <> 0 Then
                strTemp = strTemp & " " & tokens(X)
            Else:
            strTemp = strTemp & tokens(X)
            End If
            If tokens(X) = vbCrLf Then
                X = X + 1
                Exit Do
            End If
            
            lngLineWidth = rpt.TextWidth(strTemp)
            lngNumWords = lngNumWords + 1
            If X >= lngNumTokens Then
                ' Jan 23 try this to handle losing first word
                ' when all of the words fit on one line except for
                ' the last word
                If lngLineWidth > CtlCurrent.Width - (lngMargin * 2) Then
                    'lngNumWords = lngNumWords + 1
                    Exit Do
                End If
                ' Jan  23 sunday commnet out
                ' next line x = x +1
                ' losing first word
                X = X + 1
                Exit Do
            End If
            
            If lngLineWidth > CtlCurrent.Width - (lngMargin * 2) Then Exit Do
            
            X = X + 1
        Loop
    
    ' The Token Counter x is advanced if we had just hit a
    ' vbCrLf.
    ' If our string has exceeded our Control's Width
    ' then the Counter X is not advanced which effectively
    ' prunes off the last token(word) concanentated to
    ' our ourput temp String.
    
    ' This gives us the automagic advance we need on this counter
    ' to loop back to the top of this procedure and continue on.
    
    ' If we get to here than either we've exceed linelength
    ' or we've hit a CR, or  we are all done
    ' Also add error handling if 1 word is too long.
    ' Just throw word away and Substitute "*..* for now.
    ' Needs Autohyphenation logic
    If lngLineWidth > CtlCurrent.Width - (lngMargin * 2) Then
        If lngNumWords = 1 Then
            strTemp = "*..*  "
            tokens(X) = strTemp
            X = X + 1
        End If
    End If
    
    If tokens(X - 1) = vbCrLf Then boolCR = True Else boolCR = False
    ' If this is the end of the string output with no justification.
    ' Need to revisit this line of code before and add criteria
    ' to handle last line of the Control where everything fits
    ' except the very last word. We really don't want boolEOF set
    ' as we need to comeback and print the last word.
    If X >= lngNumTokens Then boolEOF = True Else boolEOF = False
    
    ' Time to output a line.
    ' If we've exceeded line length then remove last word
    ' in strTemp. Do this by rebuilding string from tokens()
    If CtlCurrent.Width - (lngMargin * 2) < rpt.TextWidth(strTemp) Then
        strTemp = ""
        For y = ((X) - (lngNumWords - 1)) To (X - 1)
            strTemp = strTemp & tokens(y) & " "
        Next y
        lngNumWords = lngNumWords - 1
        '****************
        'x = x - 1
    End If
    
    'trim trailing spaces
    strTemp = RTrim(strTemp)
    
    'If last token was a CR or EOF then output line without justification
    If boolCR Or boolEOF Then
        'Is CR on line by itself?
        If lngNumWords = 0 Then
            'Forget it..do nothing!
            'ypos = rpt.CurrentY
            'rpt.Print ""
            'rpt.CurrentY = Ypos
            
        Else:
            If boolCR Then
            'prune off last two chars, vbCrLf
            Ypos = rpt.CurrentY
            rpt.Print Left$(strTemp, Len(strTemp) - 2)
            rpt.CurrentY = Ypos
            Else:
            Ypos = rpt.CurrentY
             rpt.Print strTemp
            rpt.CurrentY = Ypos
            End If
        End If
    End If
    
    If Not boolCR Then
        If Not boolEOF Then
        ' Calculate Justification
        ' cheesy error handling for divide by zero
        ' it's late and I'm going to bed! :-)
        
        lngExtraSpace = (CtlCurrent.Width - (lngMargin * 2) - rpt.TextWidth(strTemp)) \ IIf(lngNumWords < 2, lngNumWords, (lngNumWords - 1))
        'Output the current tokens. Add spaces between words
        For y = ((X - 1) - (lngNumWords - 1)) To (X - 1)
            strTemp = tokens(y) & " "
            Ypos = rpt.CurrentY
            
            'Debug.Print "YPos at PRINTING:" & Ypos
            rpt.Print strTemp
            rpt.CurrentY = Ypos
            rpt.CurrentX = rpt.CurrentX + lngExtraSpace
        Next y
    
    'Done printing this line
        End If
    End If
    
    'Are we all done?
    If X > lngNumTokens Then
    blHasContinued = False
    ' Should add some cleanup and var reset code here
    ' even though everything seems OK.
    Exit Sub
    End If
    
' Need error checking to make sure we haven't exceeded height of control
rpt.CurrentY = rpt.CurrentY + lngLineSpaceing
'If rpt.CurrentY >= intSectionTop + intSectionHeight Then Exit Do 'rpt.height
'If rpt.CurrentY >= (intSectionTop + lngMarginTop + intSectionHeight) - _
'(varBMargin + CtlCurrent.Top) Then

' Need to check and see if ctl height is greater than section
' this signifies that WillContinue is TRUE.
' SO we need to store each control's height in another array.
' Also change these damn names to match should be intSectionHeight

' We need to determine if this section will be carried over to next
' Check ctl vs section height
' For access 97 if Ctl.Height > Section>height than WillContinue = TRUE
' intBOSection = .ScaleHeight - intpagefooter
If intSectionHeight < intlngCtlHeight Then
  
   ' Jan 20/200 just changed 20 to textheight
   If rpt.CurrentY >= rpt.ScaleHeight - (lngPageFooterHeight + CtlCurrent.top + lngMarginTop + (rpt.TextHeight("jI") / 2)) Then
   ' If rpt.CurrentY >= rpt.ScaleHeight - (lngPageFooterHeight + CtlCurrent.Top + lngMarginTop + 20) Then
            
        ' OK now save position of last Token processed
        ' and Set FLAG to tell us HasContinued
        blHasContinued = True
        LngTokenX = X ' Jan.21 2000 + 1
        Exit Do
    End If
End If

' Setup pur next horizontal position
rpt.CurrentX = intCurCtlLeft + lngMargin
' Reset vars for Loop
lngNumWords = 0
strTemp = ""
lngLineWidth = 0
boolCR = False
boolEOF = False

'Jump back and resume Main Loop
Loop

'CLEANUP
'Restore Reports original Font settings
With rpt
rpt.FontName = oldFontName
rpt.FontBold = oldFontBold
rpt.fontsize = oldFontSize
rpt.FontItalic = oldFontItalic
rpt.ForeColor = oldForeColor
End With

' Final Cleanup
Set CtlCurrent = Nothing

End Sub


Public Sub fRecordSection(rpt As Report, ctl As Access.TextBox, PrintCount)
' Records all of the required data for the
' pertinent Control's during the Detail Print Event.
' Called from the Report's Detail Print Event.


' Module level variable.
' Couldn't figure any other way to do it cleanly.
strCtlName = ctl.Name

Dim ctlTemp As Control

On Error Resume Next

'***********
'FIND A GOOD PLACE TO INITIALIZE DATA
If IsNull(lngTop(0)) Then
ReDim lngTop(0)
ReDim lngCtlLeft(0)
ReDim varData(0)
ReDim lngHeight(0)
ReDim lngCtlHeight(0)
End If

For Each ctlTemp In rpt.Section(ctl.Section).Controls
    With ctlTemp
        If ctlTemp.Name = ctl.Name Then
                
        lngCtlLeft(UBound(lngCtlLeft)) = .Left
        lngTop(UBound(lngTop)) = rpt.top
        'Debug.Print "Section Top:" & rpt.Top
        varData(UBound(varData)) = rpt.Controls(ctl.Name)
        lngHeight(UBound(lngHeight)) = rpt.Height
        lngCtlHeight(UBound(lngCtlHeight)) = .Height
        
        'Debug.Print "Ctl Height:" & .Height
        'Debug.Print "Section Height:" & rpt.Height
        'Debug.Print Left(rpt.Controls(ctlname), 30)
        ReDim Preserve lngTop(UBound(lngTop) + 1)
        ReDim Preserve lngCtlLeft(UBound(lngCtlLeft) + 1)
        ReDim Preserve varData(UBound(varData) + 1)
        ReDim Preserve lngHeight(UBound(lngHeight) + 1)
        ReDim Preserve lngCtlHeight(UBound(lngCtlHeight) + 1)
        End If
    End With
Next

' Clean up
Set ctlTemp = Nothing

End Sub


Private Sub Class_Initialize()
' Get next Free File Number
m_FileNumber = FreeFile

' Allow for multiple instances of this Class
Open "c:\Reportlog" & m_FileNumber & ".txt" For Output As #m_FileNumber

End Sub

Private Sub Class_Terminate()
Close #m_FileNumber
End Sub


Public Sub PrintSectionLog(rpt As Access.Report, SectionCtl As Object)
' Creates a Profile Report Log of
' the Report's Sections and Controls.
' Used to Debug Positioning problems and see just
' what logic Access uses when working with
' CanGrow/CanShrink, Keep Together, & Has Continued logic.
' Called from Report Class module ie:
' Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
' If PrintCount = 1 Then
' Call Justi1.PrintSectionLog(Me, Me.Section(acDetail).Controls(1))
' End If
' End Sub
'
' You must call this function from every Report Section's Print event
' that you have on your Report. Except for the Detail Section you must
' specify directly the Control you are passing.
' For example:
' Call Justi1.PrintSectionLog(Me, Me.LblCustomerIDFooter)
' The SectionCtl must be declared as Object to accomodate
' all of the possible Control/Object types
' that may be passed.

Dim ctl As Control
Dim sect As Section

' We need the current Section to enumerate
' through it's Control's Collection
Set sect = rpt.Section(SectionCtl.Section)

' We only want to Print our Page Header
' at the Top of each page of the
' Log Report we generate.
Static CurPage As Long

If CurPage <> rpt.Page Then

' First time through on this page.
' Let's Print our Log Report Page Header Info.
Print #m_FileNumber, " "
Print #m_FileNumber, " "
With rpt
Print #m_FileNumber, "**REPORT**"; Tab; "REPORT NAME:"; .Name; Tab; "PAGE#:"; rpt.Page; " of:"; rpt.Pages
Print #m_FileNumber, '---------------------------------------------------------------------------------""
Print #m_FileNumber, "ScaleHeight:"; Tab; "Report Height:"; Tab; "ScaleTop:"; Tab; "Top:"
Print #m_FileNumber, .ScaleHeight; Tab; .Height; Tab; Tab; .ScaleTop; Tab; .top
End With

End If
' We've printed our Log Report Page Header
' Make sure we don't print it again until
' we hit the next page.
CurPage = rpt.Page

' Seperator  Spaces
Print #m_FileNumber, " "
Print #m_FileNumber, " "

' Print Section Details
With sect
Print #m_FileNumber, "----------------------------------------------------------------------------------"
' Note that rpt.Top is actaully this Section's TOP property. **important**!
Print #m_FileNumber, "**SECTION**"; Tab; "SECTION NAME:"; .Name; Tab; "Section Height:"; .Height; Tab; "S.Top:"; rpt.top
End With
Print #m_FileNumber, "----------------------------------------------------------------------------------"

' Enumerate Section's Control Collection
Print #m_FileNumber, "**SECTION CONTROLS**"

Print #m_FileNumber, Tab(30); "Width:"; Tab; "Height:"; Tab; "Top:"
For Each ctl In sect.Controls
    With ctl
        Print #m_FileNumber, Left(.Name, 28); Tab(30); .Width; Tab; .Height; Tab; .top
    End With
Next
' Seperator for this Section
Print #m_FileNumber, "**********************************************************************************"

' Cleanup - Set all objects to Nothing
Set sect = Nothing
Set ctl = Nothing

End Sub

şimdi bunu form üzerinde nasıl kullanırım bilgisi olan arkadaşlar bir bakarsa sevinirim. zira bu konuda dün gecen beri baktım tam olarak açıklayıcı bir bilgi yok.
Cevapla
Çözüldü #5
ekteki Lebans'ın örneğini inceleyiniz.

bu uygulamanın çalışabilmesi için rtf2.ocx'in system32 ye eklenmesi ve accesse kaydedilmesi gerekmekte. Polsoft'u kurduysanız bu işlemler yapılmıştır.
.zip A2K RTF2 Sample Release 5-5.zip (Dosya Boyutu: 70,16 KB | İndirme Sayısı: 58)
Cevapla
Çözüldü #6
Evet sonunda oldu tabi. ama işin kötü tarafı rtf2.ocx devaml yanında taşımak lasım Img-grin. neyse yardım eden arkadaşlara teşekkürler.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da