Results 1 to 3 of 3
  1. #1
    Alex Motilal is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2008
    Location
    Coimbatore, India
    Posts
    192

    Functions

    Hi Everybody,

    I am using the following Function in a module to return addresses in reports.



    Function AddressBlock(strName, strAddress, strStreet, strArea, strCity, strPin) As String

    Dim strFirstRow As String, strSecondRow As String, strThirdRow As String
    Dim strFourthRow As String, strFifthRow As String, strHardReturn As String

    strFirstRow = NulltoString(strName)
    strSecondRow = NulltoString(strAddress)
    strThirdRow = NulltoString(strStreet)
    strFourthRow = NulltoString(strArea)
    strFifthRow = strCity & " - " & strPin

    AddressBlock = strFirstRow & strSecondRow & strThirdRow & strFourthRow & strFifthRow

    End Function

    Function NulltoString(Optional strCheckValue) As String

    If IsNull(strCheckValue) Then
    NulltoString = ""
    Else
    NulltoString = strCheckValue & Chr(13) & Chr(10)
    End If
    End Function

    What I need is that the First row should be in heavy font and the Fifth row should also be in heavy font and underlined.

    Can enyone suggest what code should I add to get the desired result?

    With thanks
    Alex

  2. #2
    ChrisO is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2005
    Location
    Brisbane, Australia
    Posts
    27
    Five text boxes named txtRow0 to txtRow4.
    Each set to can shrink.
    Format each as you see fit.

    Code:
    Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
        Dim strAddress() As String
        Dim intIndex     As Integer
    
        strAddress = Split(AddressBlock("Some Name", _
                                        "Some Address", _
                                        "Some Street", _
                                        "Some Area", _
                                        "Some City", _
                                        "Some Pin"), vbCrLf)
        
        For intIndex = LBound(strAddress) To UBound(strAddress)
            Me("txtRow" & CStr(intIndex)) = strAddress(intIndex)
        Next intIndex
        
    End Sub
    
    
    Function AddressBlock(strName, strAddress, strStreet, strArea, strCity, strPin) As String
        Dim strFirstRow As String, strSecondRow As String, strThirdRow As String
        Dim strFourthRow As String, strFifthRow As String
        
        strFirstRow = NulltoString(strName)
        strSecondRow = NulltoString(strAddress)
        strThirdRow = NulltoString(strStreet)
        strFourthRow = NulltoString(strArea)
        strFifthRow = strCity & " - " & strPin
        
        AddressBlock = strFirstRow & strSecondRow & strThirdRow & strFourthRow & strFifthRow
    
    End Function
    
    
    Function NulltoString(Optional strCheckValue) As String
    
        If IsNull(strCheckValue) Then
            NulltoString = "" & Chr(13) & Chr(10)
        Else
            NulltoString = strCheckValue & Chr(13) & Chr(10)
        End If
        
    End Function
    HTH

    Chris.

  3. #3
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Quote Originally Posted by Alex Motilal View Post
    What I need is that the First row should be in heavy font and the Fifth row should also be in heavy font and underlined.
    you can not put different style for different lines in one textbox,
    you need to design one textbox for each line. then set the first and the fifth textbox to the style/font as you want.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Custom Functions
    By TheDeceived in forum Access
    Replies: 3
    Last Post: 09-16-2010, 02:12 PM
  2. sum functions
    By trippers in forum Queries
    Replies: 2
    Last Post: 08-04-2010, 07:09 PM
  3. Functions
    By jamin14 in forum Programming
    Replies: 1
    Last Post: 03-25-2010, 08:16 AM
  4. Help with functions / procedures
    By curnil in forum Programming
    Replies: 3
    Last Post: 03-09-2010, 05:41 PM
  5. Multiple IIF functions possible?
    By Northgate in forum Access
    Replies: 0
    Last Post: 10-08-2008, 01:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums