Preparation of the vb report template of the data room Charging System (I ).
The data room charging system has the report function, which is a bit unfamiliar to us. Isn't it an accounting task? How is the data room Charging System Integrated? In fact, we have learned the report steps. After understanding the Code, it is not very difficult to report the report. Is it easy to climb the report!
The following are the report steps.
1. Install the Grid ++ Report designer (download and install it online)
2. download and install the control and reference it in components of vb project.
3. Create a template (import it to vb at that time)
4. Use the code in vb to link the report
Below are the steps for creating only a Report Template
1. After the report designer is installed, open the following interface:
2. Insert a report header: In the menu bar of the report designer, locate insert-Report header.
3. Insert a static box: Insert a static box to display the report title. Execute the "insert-static box" menu and drag and drop a rectangular area in the display area of the report header, double-click to change the title. For example
4. Define the detail Grid
1. Insert detail grid: insert-Detail grid. The newly inserted detail grid is displayed in the report layout window. For example
2. database connection string and query SQL: Select "database connection string and query SQL" on the toolbar of the detail grid to open the definition window. For example
As shown in the following figure:
5. Define a database connection string: Create a database connection string in the lower-left corner of the execution window...
Remember to tick the password that can be saved
Test passed
6. Create a field: Edit. query the SQL statements to generate a field. For example
Create a column: "edit-generate table columns Based on fields"
Change the title as shown in Figure
Adjust column width: move the cursor to the right boundary of the column for drag and drop
Change the display text of the table title: Follow the prompts in.
7. Define the page number displayed in the footer
1. Insert footer: Execute the "insert-footer" menu. The newly inserted footer is displayed in the report layout window.
2 insert a text box to display the printing time:
Insert integrated text box: Select "integrated text mining" in the toolbar of the Part Box, and drag and drop a rectangle on the left of the footer. A comprehensive text box has been inserted.
Set display content: Select the "text" line in the property editing window in the lower right corner and click "..." to open the text editing dialog box. Enter text in the edit box.
Select system variables in reference type
Select the current date and time in the system variable
Click OK to preview
The effect is not perfect. I have a smile. After that, we don't think it is too difficult. If there is a saying, don't know, don't know, or even don't know, in fact, this is the case after we know it. We should be good at standing on the shoulders of giants to learn the knowledge. Well, we can save it. As for how to make it interact with vb, please refer to the next blog.
Who can give me a system template for booking similar data center in vb?
Public SysFlag As Integer
Public Db As String
Public Sub DbConn (ByVal AdoName, ByVal DbName)
AdoName. ConnectionString = "Provider = Microsoft. Jet. OLEDB.4.0;" & "Data Source =" & App. Path + "\ RegSys. mdb" & "; Persist Security Info = False"
AdoName. RecordSource = "select * from" & DbName
AdoName. Refresh
End Sub
Public Sub UserCheck (ByVal AdoName, ByVal User, ByVal DbName, ByVal PWDCheck1, ByVal PWDCheck2, ByVal FormName)
AdoName. RecordSource = "select password from" & DbName & "where username = '" & User &"'"
AdoName. Refresh
If PWDCheck1 = PWDCheck2 Then
Msg User, 1
FormName. Hide
FrmMain. Show
Else
Msg User, 0
End If
End Sub
Public Sub Msg (Optional Name, Optional Flag)
Select Case Flag
Case 1:
MsgBox Name & ", welcome to log on! "
Case 0:
MsgBox Name & ", check your user Name or password. "
Case 2:
MsgBox "user name and password cannot be blank! "
End Select
End Sub
Public Sub StyleCheck (ByVal Group)
Select Case Group
Case "admin": frmMain. menuAction. Visible = False
SysFlag = 1
Case "student ":
FrmMain. menuAdminAction. Visible = False
FrmMain. menuRegTeacher. Visible = False
FrmMain. menuEditTeacher. Visible = False
SysFlag = 2
Case "teacher ":
FrmMain. menuAdminAction. Visible = False
FrmMain. menuRegSingle. Visible = False
FrmMain. menuEditSingle. Visible = False
SysFlag = 3
End Select
End Sub
Public Sub Query (ByVal AdoName, ByVal DbName, ByVal Dater)
AdoName. RecordSource = "select * from" & DbName & "...... the remaining full text>
Use VB to connect to an EXCEL report instance. If you need the source code, you 'd better append the score together with the project.
You need to reference microsoft excel object library ..
In this way, the data can be output to excel.
Public Sub saveToExcel12 ()
Dim xl As Excel. Application
Dim xlBook As Excel. Workbook
Dim xlsheet As Excel. Worksheet
Dim I As Integer, J As Integer
Set xl = CreateObject ("excel. application ")
If xl Is Nothing Then
MsgBox "are you sure Microsoft Excel is installed correctly? ", VbQuestion
Exit Sub
End If
Xl. Visible = True
Set xlBook = xl. Workbooks. Add
Set xlsheet = xlBook. ActiveSheet
Xlsheet. Name = "result data"
For J = 0 To msgrid1.Rows-1
For I = 0 To 2
Msgrid1.Row = J
Msgrid1.col = I
Xlsheet. Cells (J + 1, I + 1) = msgrid1.Text
Next I
Next J
End Sub