2. Compared with the previous excel files, I think the report is a bit the same. The general idea is as follows: first define. (Report: DimWithevents object variable As class name is used to load events of this class. After Withevents, you can see the events of this class in the code editing window (if any ). Because the class is not like a control, double-click Control
2. Compared with the previous excel files, I think the report is a bit the same. The general idea is as follows: first define. (Report: The Dim Withevents object variable As class name is used to load events of this class. After Withevents, you can see the events of this class in the code editing window (if any ). Because the class is not like a control, double-click Control
Ii. Code
Compared with the previous excel, I think the report is a bit the same. The general idea is as follows:
First.
(Report: Dim Withevents object variable As Class Name
This method is used to load events of this class. After Withevents, you can see the events of this class in the code editing window (if any ).
Unlike controls, double-click controls to edit events.
Note the following constraints when using the WithEvents variable:
WithEvents variables cannot be derived object variables. That is to say, it cannot be declared As an As Object-the class name must be specified when the variable is declared.
The WithEvents variable cannot be declared As New. You must explicitly create an event source object and assign it to the WithEvents variable .)
Instantiate the report and open the report location.
Link the data source. (Because the data source has been connected to the report, the program can still run normally after I comment this sentence. Write address in excel)
Query the table and display the table content.
Let's take a look at the code below:
'Definition Dim WithEvents report As grproLibCtl.GridppReport
'Load a New report Set report = New grproLibCtl. gridppreport' load the report template file report. loadFromFile (App. path & "\ daily report. grf ") 'set data connection string' report. detailGrid. recordset. connectionString = ConnectString ': the data source is connected to the report. Txtsql = "select * from checkday_Info where date = '" & Date & "'" report. detailGrid. recordset. querySQL = txtsql 'execute 'to display the report content grddayBill. report = report grddayBill. the 'start' report Template has four date or time values: report. parameterByName ("Date1 "). value = Format (Date, "yyyy-MM-dd") report. parameterByName ("Datetime "). value = Now report. parameterByName ("username "). value = UserName
Iii. Summary
Therefore, it is not too difficult to clarify the principles and ideas of many new things.
I am very grateful to Yang Chen for the two blogs.
Settlement and report of the data room Charging System (3) VB and report code "one school will be a dumb version"
Bill settlement and report of the data room Charging System (2) weekly report making the "One School will be a dumb version"