We have a fundraising business and use Access as our do everything database. We currently create customized letters to send to our customers that have their schools or teams name at the top. Currently we do this in MS word with word art.
I would like to start creating these letter with Access, but Access does not support Word Art and i cant figure out how to create a variable title field. Sometimes the title (school or team name) can be as short as 10 characters and other times it could be 65 characters.
I have tried doing if then statements through VBA to adjust the text size, but you can not align where the text lays in the text box or label as far as i know. ( If the text is small it will float in the middle of the box, but if it is large then it will Take up the whole space. I am running out of ideas. I think the next approach i might take is to define the text size, the size of the text box or label, and the location of the text box or label on the report, but i am not even sure if that is possible through VBA. Any thoughts?
Here is a sample of the code that i am using to determine the font size. I am sure there is probably a better way so please feel free to suggest one.
Private Sub Report_Load()
Dim PLT As String
PLT = [ParentLetterTitle]
If Len([ParentLetterTitle]) > 64 Then
Me.Report.Label1.Caption = [ParentLetterTitle]
Me.Report.Label1.FontSize = 11
Else
If Len([ParentLetterTitle]) > 10 Then
Me.Report.Label1.Caption = [ParentLetterTitle]
Me.Report.Label1.FontSize = 66
Else
If Len([ParentLetterTitle]) > 9 Then
Me.Report.Label1.Caption = [ParentLetterTitle]
Me.Report.Label1.FontSize = 73
End If
End If
End If
End Sub
I tried to Dim [ParentLetterTitle] as PLT, but it was not working so i dropped it for right now. In order to figure out the font size in relation to the number of characters i went into word and typed "XXX" across the screen and changed the font size to determine the number of characters that would fit on a line. I went under the assumption that the X was the widest character in the font that i chose.
Thanks for all the help i was a psych major so most coding is foreign to me!
I would like to start creating these letter with Access, but Access does not support Word Art and i cant figure out how to create a variable title field. Sometimes the title (school or team name) can be as short as 10 characters and other times it could be 65 characters.
I have tried doing if then statements through VBA to adjust the text size, but you can not align where the text lays in the text box or label as far as i know. ( If the text is small it will float in the middle of the box, but if it is large then it will Take up the whole space. I am running out of ideas. I think the next approach i might take is to define the text size, the size of the text box or label, and the location of the text box or label on the report, but i am not even sure if that is possible through VBA. Any thoughts?
Here is a sample of the code that i am using to determine the font size. I am sure there is probably a better way so please feel free to suggest one.
Private Sub Report_Load()
Dim PLT As String
PLT = [ParentLetterTitle]
If Len([ParentLetterTitle]) > 64 Then
Me.Report.Label1.Caption = [ParentLetterTitle]
Me.Report.Label1.FontSize = 11
Else
If Len([ParentLetterTitle]) > 10 Then
Me.Report.Label1.Caption = [ParentLetterTitle]
Me.Report.Label1.FontSize = 66
Else
If Len([ParentLetterTitle]) > 9 Then
Me.Report.Label1.Caption = [ParentLetterTitle]
Me.Report.Label1.FontSize = 73
End If
End If
End If
End Sub
I tried to Dim [ParentLetterTitle] as PLT, but it was not working so i dropped it for right now. In order to figure out the font size in relation to the number of characters i went into word and typed "XXX" across the screen and changed the font size to determine the number of characters that would fit on a line. I went under the assumption that the X was the widest character in the font that i chose.
Thanks for all the help i was a psych major so most coding is foreign to me!