📄 frmjd_zs.frm
字号:
VERSION 5.00
Begin VB.Form frmjd_zs
Caption = "下发质量鉴定证书"
ClientHeight = 5370
ClientLeft = 60
ClientTop = 345
ClientWidth = 6795
Icon = "frmjd_zs.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5370
ScaleWidth = 6795
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command3
Caption = "打印(&P)"
Height = 375
Left = 3930
TabIndex = 13
Top = 4920
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "关闭(&C)"
Height = 375
Left = 5460
TabIndex = 12
Top = 4920
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "保存(&S)"
Height = 375
Left = 2400
TabIndex = 11
Top = 4920
Width = 1215
End
Begin VB.Frame Frame1
Caption = "质量鉴定证书"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4695
Left = 120
TabIndex = 0
Top = 120
Width = 6555
Begin VB.TextBox Text1
Height = 315
Index = 4
Left = 5220
TabIndex = 10
Top = 780
Width = 1095
End
Begin VB.TextBox Text1
Height = 315
Index = 3
Left = 3060
TabIndex = 8
Top = 780
Width = 855
End
Begin VB.TextBox Text1
Height = 3255
Index = 2
Left = 1080
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 7
Top = 1200
Width = 5235
End
Begin VB.TextBox Text1
Height = 315
Index = 1
Left = 1080
TabIndex = 6
Top = 780
Width = 855
End
Begin VB.TextBox Text1
ForeColor = &H000000C0&
Height = 315
Index = 0
Left = 1080
Locked = -1 'True
TabIndex = 5
Top = 360
Width = 5235
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "鉴定负责人:"
Height = 180
Index = 4
Left = 4200
TabIndex = 9
Top = 840
Width = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "质量等级:"
Height = 180
Index = 3
Left = 2220
TabIndex = 4
Top = 840
Width = 810
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "鉴定意见:"
Height = 180
Index = 2
Left = 240
TabIndex = 3
Top = 2737
Width = 810
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "初验等级:"
Height = 180
Index = 1
Left = 240
TabIndex = 2
Top = 840
Width = 810
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "工程名称:"
Height = 180
Index = 0
Left = 240
TabIndex = 1
Top = 420
Width = 810
End
End
End
Attribute VB_Name = "frmjd_zs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim adoPrimaryRS As Recordset
Dim db As Connection
Private Sub Command1_Click()
On Error GoTo err_27
If adoPrimaryRS.RecordCount < 1 Then
y = MsgBox(xz_gz_xm & "工程还末下发鉴定证书,确认现在下发吗?", vbYesNo + vbQuestion)
If y = 6 Then
adoPrimaryRS.AddNew
Command1.Caption = "保存(&S)"
Command3.Enabled = True
Else
Exit Sub
End If
End If
adoPrimaryRS("工程名称") = xz_gz_xm
adoPrimaryRS("初验等级") = Text1(1).Text
adoPrimaryRS("鉴定意见") = Text1(2).Text
adoPrimaryRS("质量等级") = Text1(3).Text
adoPrimaryRS("鉴定负责人") = Text1(4).Text
adoPrimaryRS.Update
Exit Sub
err_27:
MsgBox Err.Description, vbExclamation
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Static p As Integer
Dim db1 As Connection
Dim rs1 As Recordset
Dim objword As Word.Application
Dim objdoc As Word.Document
Dim rs As Recordset
Set rs = New Recordset
rs.Open "select * from gz_gk where 工程名称='" & xz_gz_xm & "'", db, adOpenStatic, adLockOptimistic
Set db1 = New Connection
db1.CursorLocation = adUseClient
db1.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & fullpath("mdb\nd_jd_jh.lbl")
Set rs1 = New Recordset
rs1.Open "select 项目,建设经费,计划年度,序号 from nd_jh where 项目='" & xz_gz_xm & "'", db1, adOpenStatic, adLockOptimistic
mydoc_path = fullpath("dot\鉴定证书.dot")
Set objword = New Word.Application
p = p + 1
Set objdoc = objword.Documents.Open(mydoc_path)
objdoc.Activate
With objdoc
.Bookmarks("证书编号").Range.Text = rs1("计划年度") & "—" & Format(rs1("序号"), "00")
.Bookmarks("工程名称").Range.Text = adoPrimaryRS("工程名称") & "工程"
.Bookmarks("工程地点").Range.Text = rs("工程地点")
.Bookmarks("工程投资").Range.Text = rs1("建设经费") / 10000 & "万元"
.Bookmarks("技术标准").Range.Text = rs("工程技术标准")
.Bookmarks("建设单位").Range.Text = rs("建设单位")
.Bookmarks("设计单位").Range.Text = rs("设计单位")
.Bookmarks("施工单位").Range.Text = rs("施工单位")
.Bookmarks("开竣工时间").Range.Text = rs("计划开工日期") & "至" & rs("计划竣工日期")
.Bookmarks("初验等级").Range.Text = adoPrimaryRS("初验等级")
.Bookmarks("鉴定意见").Range.Text = adoPrimaryRS("鉴定意见")
.Bookmarks("质量等级").Range.Text = adoPrimaryRS("质量等级")
.Bookmarks("下发时间").Range.Select
.ActiveWindow.Selection.InsertDateTime DateTimeFormat:="yyyy'年'M'月'd'日'", InsertAsField _
:=False, DateLanguage:=wdSimplifiedChinese, CalendarType:= _
wdCalendarWestern, InsertAsFullWidth:=False
End With
temp1 = xz_gz_xm & "鉴定证书" & p & ".doc"
objdoc.SaveAs fullpath("doc\" & temp1)
objword.Visible = True
End Sub
Private Sub Form_Load()
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & fullpath("mdb\nd_jd_jh.lbl")
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from jd_zs where 工程名称='" & xz_gz_xm & "'", db, adOpenStatic, adLockOptimistic
Text1(0).Text = xz_gz_xm & "工程"
If adoPrimaryRS.RecordCount >= 1 Then
Text1(1).Text = adoPrimaryRS("初验等级")
Text1(2).Text = adoPrimaryRS("鉴定意见")
Text1(3).Text = adoPrimaryRS("质量等级")
Text1(4).Text = adoPrimaryRS("鉴定负责人")
Else
Command1.Caption = "下发证书(&S)"
Command3.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -