I have an on Format event that changes the font style/size depending on the value of a field. It works very well, but the control is not growing to fit the contents, even though the 'cangrow' property (for both the detail section & the textbox) is set to yes. I am using Access 2003. Do I have to add that property to the on Format event coding (listed below)? If so, how do you do so?
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.[KP Country] <> "USA" Then
Dim strFirst As String
Dim strLast As String
Dim intLeft As Integer
Dim intTop As Integer
strFirst = Left(Me.Current_City_Country, InStr(Me.Current_City_Country, "(") - 1)
strLast = Mid(Me.Current_City_Country, InStr(Me.Current_City_Country, "(") + 1)
Me.CurrentX = Me.Current_City_Country.Left
Me.CurrentY = Me.Current_City_Country.Top
Me.FontBold = True
Me.FontSize = 9
Me.Print strFirst & " "
Me.FontBold = False
Me.FontSize = 8
Me.CurrentY = Me.Current_City_Country.Top
Me.Print "(" & strLast
Else
strFirst = Left(Me.Current_City_Country, InStr(Me.Current_City_Country, "(") - 1)
Me.CurrentX = Me.Current_City_Country.Left
Me.CurrentY = Me.Current_City_Country.Top
Me.FontBold = True
Me.FontSize = 9
Me.Print strFirst
End If
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.[KP Country] <> "USA" Then
Dim strFirst As String
Dim strLast As String
Dim intLeft As Integer
Dim intTop As Integer
strFirst = Left(Me.Current_City_Country, InStr(Me.Current_City_Country, "(") - 1)
strLast = Mid(Me.Current_City_Country, InStr(Me.Current_City_Country, "(") + 1)
Me.CurrentX = Me.Current_City_Country.Left
Me.CurrentY = Me.Current_City_Country.Top
Me.FontBold = True
Me.FontSize = 9
Me.Print strFirst & " "
Me.FontBold = False
Me.FontSize = 8
Me.CurrentY = Me.Current_City_Country.Top
Me.Print "(" & strLast
Else
strFirst = Left(Me.Current_City_Country, InStr(Me.Current_City_Country, "(") - 1)
Me.CurrentX = Me.Current_City_Country.Left
Me.CurrentY = Me.Current_City_Country.Top
Me.FontBold = True
Me.FontSize = 9
Me.Print strFirst
End If
End Sub