FAQ
 
 
home
 
FAQ
Q

When Compiling this in VB I get a Compile Error "Object does not source automation events" with "WithEvents m_objReport As Report" Highlighted by the IDE.

A Declare “WithEvents m_objReport As VRPTS22.Report”
Declare the following events within the module/form that contains m_objReport.

Public Sub m_objReport_NewPage()
End Sub
Public Sub m_objReport_PrintFooter()
End Sub

Q I receive the following error “Runtime Error 91 - "Object variable or With block variable not set” when accessing a section. I checked the spelling of the section and it is correct.
A Section or field object by name are case sensitive. If you have a section define in the report as “Detail” and or try accessing m_objReport.Section(“detail”) an Error 91 will occur. The correct way to access the section would be m_objReport.Section(“Detail”).
Q Is there anyway to keep the group together on one page.
A The best way to do this is to check the report.CorrY + section.Height. If the sum of these two values is greater than the report.PageHeight, then call the report.PrintNewPage method. This will keep your group section on the same page.
Q I set the LicCode and LicNumber properties on the report object with values given to me when I purchased and registered Visual Reports, but I still get the evaluation message on the bottom of my reports.
A
Make sure you set the LicCode and LicNumber before you make a call to LoadReport on the report object.
m_objReport.LicCode = ""
m_objReport.LicNumber =
m_objReport.LoadReport(App.Path & "\" & sReportName)
Q I have an VRPTS22.Report object "RPT" -- it is declared WithEvents Report has 3 bands, "Header", "Detail" and "Footer" I have a public sub RPT_PrintFooter() and also one for the header The header fires as expected. The footer never fires. Any ideas what I may be doing wrong.
A Make sure you set the SetPageFooter method within the report object - m_objReport.SetPageFooter "Footer"
Q I have some field names longer than may fit in the column heading field. I want these to wrap. There is a division line at the bottom of the Header. When the fields wrap to 3 lines they fall into the division line.
A
Visual Reports with not manage word-wrap logic with field texts within a section. It does manage word-wrap logic if the field text goes outside the section. There are three approaches you can take to solve your issue:
  1. If you know the header labels that have word-wrap, create two field labels, place one on top of the other.
  2. You can calculate the offset yourself. Look at the PrintEmployeeReport subroutine within the demo application.
  3. Create two section for your header, one section for the field labels and one section for the division line.
Q I am writing a receipt that I has in 3 sections. The top section contains column headers - "Item", "Description", "Price", etc. The middle section contains the list of individuals items - #512 Item 1 $2.00, etc. The bottom section is the total area - Subtotal, tax and total. I don't see a section.top property, how can I control the position of a section. I want the bottom section to be 3 inches above the bottom of the page.
A There are two options you can use. The first option would be to use the CurrY property of the report object. This property navigates where the printing should start on the y axis. I would probable do something like: m_objReport.CorrY = m_objReport.PageHeight - (3 * 1440) '1440 twips = 1 inch m_objReport.PrintSection "bottom". The second option would be to make the bottom section the page footer. Make the section height 3 inches in height so it will always print 3 inch from the bottom of the page. m_objReport.SetPageFooter "bottom"
   
Q According to the help file, LoadReport returns True if it's successful and False if it's not successful. If I pass it a nonexistent file (e.g. "test.vrd" in the example, which doesn't exist on my system) it still returns True. Shouldn't it return False for a nonexistent file?
A Yes, this is a known issue. You can call FileLen before calling LoadReport. If FileLen returns Err 53 then the file does not exists.

Dim nRetVal As Long
Dim nErrNbr As Long
On Error Resume Next
bRetVal = FileLen(sReportFile)
nErrNbr = Err.Number
On Error Goto 0
If nErrNbr <> 53 Then
m_objReport.LoadReport(sReportFile)
Else
MsgBox sReportFile & " does not exist!"
End If
Q Create a report with two different fonts. Courier New for details. It prints to the printer ok, but if you print to PDF the Courier New font does not get used.
A The PDF engine only supports Arial/Helvetica, Courier, Times Roman and Verdana. If a font is not supported it will default to Helvetica.  Arial and Helvetica are the same font, Microsoft just renamed Helvetica to Arial.
 
   
   
©2008 www.sparrow-technologies.com