求VB打印功能代码
求助各位编程高手~~我想在学生成绩管理系统里面加一个打印的功能~~想问下代码是什么?我用VB+ACC做的~~求助~~VB代码为
Private Sub add_Click()
Call Command1_Click
End Sub
Private Sub change_Click()
Call Command3_Click
End Sub
Private Sub Command1_Click() '添加
Form2.Show
End Sub
Private Sub Command2_Click() '删除
Dim m As String
m = MsgBox("你确定要删除吗?想清楚再说!", vbYesNo, "删除对话框")
If m = vbYes Then
Adodc1.Recordset.Delete
MsgBox "删除成功"
End If
If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then
MsgBox "都被你删掉了,快添加数据啊!"
change.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command2.Enabled = False
find.Enabled = False
del.Enabled = False
Form1.Adodc1.Refresh
End If
End Sub
Private Sub Command3_Click()
Form3.Show
End Sub
Private Sub Command4_Click() '查找
Dim k As Integer
k = MsgBox("按学号查找吗?选择否按姓名查找", vbYesNoCancel, "选择")
If k = 6 Then
Call num_Click
ElseIf k = 7 Then
Call name_Click
End If
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub DataGrid1_Click()
Form1.Adodc1.Refresh
Form1.DataGrid1.Refresh
End Sub
Private Sub del_Click()
Call Command2_Click
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub Form_Load()
Adodc1.CommandType = adCmdText
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\成绩.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from 学生成绩"
Set DataGrid1.DataSource = Adodc1
If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
change.Enabled = False
del.Enabled = False
find.Enabled = False
End If
End Sub
Private Sub name_Click()
Dim sname As String
sname = InputBox("请输入要查找的学生姓名", "按学生姓名查找")
If Not sname = "" Then
Adodc1.Recordset.find "姓名=" & " '" & sname & "'"
If Adodc1.Recordset.EOF Then
MsgBox "查无此学生!"
Adodc1.Recordset.MoveFirst
End If
Else
Exit Sub
End If
End Sub
Private Sub num_Click()
Dim sname As String
sname = InputBox("请输入要查找的学生学号", "按学生学号查找")
If Not sname = "" Then
Adodc1.Recordset.find "学号=" & " '" & sname & "'"
If Adodc1.Recordset.EOF Then
MsgBox "查无此学生!"
Adodc1.Recordset.MoveFirst
End If
Else
Exit Sub
End If
End Sub
求助打印按钮的代码~~要能连到数据库的~~谢谢~~我是菜鸟~~~希望能尽快帮助~~