Inserting font size in a report through programming.

exaccess

Registered User.
Local time
Today, 11:08
Joined
Apr 21, 2013
Messages
287
Hi All,
I have a form which gets information from the user and upon pressing a button I produce address labels for the user. The form calls a report which does the job. This works. Now the user would like to have parameters like fonttype, fontsize and fontcolour together with margins, row and column space so that the output can be better tailored to his needs. I have inserted combo boxes on the form to get these parameters from the user, but how am I going to insert these parameters in the report layout through programming. What should be the approach? Any help will be deeply appreciated. Thanks.
 
OK. I understand that perhaps the subject is not clear. I shall reword it and hopefully and will get an experts attention. This is what I am printing on the label:
Code:
=(ConCarte([CARTE])+Chr(13) & Chr(10)+ConLab([MR],[NOM],[PRENOM])+Chr(13) & Chr(10)+[RUE]+Chr(13) & Chr(10)+[RUEBIS]+Chr(13) & Chr(10)+[VILLE]+Chr(13) & Chr(10)+ConRep([Country]))
As you can see it is a concatenated field called strCountry intended to print labels by suppressing any spaces that may occur.
This is my code of the detail section of the report.
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim rpt As Report
    Set rpt = Me
    rpt.FontName = G_FontName
    rpt.FontSize = CInt(G_FontSize)
        Select Case G_FontStyle
            Case "Bold"
            rpt.FontBold = True
            Case "Italic"
            rpt.FontItalic = True
            Case "Underline"
            rpt.FontUnderline = True
        End Select
End sub
The report goes ahead and prints as usual without taking my parameters into account. How can I make the report print this field with these parameters?. I am missing something but what? Please help.
 
Last edited:
I think you need to set the font property for each control on the report.
 
Yes the hint looks promising. Shall I put them inside the sub? Stupid question. Of course there to be able to change them. But how do I access the properties of the controls on the report. Could you please give me a few examples. Many thanks.
 
I've made a small sample for you.
Open the form choose from the comboboxes and click the button.
 

Attachments

I have replaced the sub
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
by the code given below which is based on your code
Code:
Private Sub Report_Load()
'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim rpt As Report_AROLAB01
    Set rpt = Me
  rpt.strCountry.FontName = G_FontName
  rpt.strCountry.FontSize = G_FontSize
  Select Case G_FontStyle
    Case "Bold"
        rpt.strCountry.FontBold = True
    Case "Italic"
        rpt.strCountry.FontItalic = True
    Case "Underline"
        rpt.strCountry.FontUnderline = True
  End Select
    
End Sub

Now it works. I assume suppressing Detail_Format Sub would not cause any problems. Thanks a lot. The reason it took me so long to come back is that because of a form reset function I had other application problems to sort out. There I have a question but that will be the subject of another thread. Again many thanks.
 

Users who are viewing this thread

Back
Top Bottom