【VB开源代码栏目提醒】:本文主要为网学会员提供FMRepairTable.frm,希望对需要FMRepairTable.frm网友有所帮助,学习一下!
VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDatGrd.ocx"
Begin VB.Form FMRepairTable
Caption = "维修单明细表"
ClientHeight = 4890
ClientLeft = 60
ClientTop = 345
ClientWidth = 8055
LinkTopic = "Form1"
ScaleHeight = 4890
ScaleWidth = 8055
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 3735
Left = 0
TabIndex = 5
Top = 600
Width = 7935
Begin MSDataGridLib.DataGrid DataGrid1
Height = 3375
Left = 120
TabIndex = 6
Top = 240
Width = 7695
_ExtentX = 13573
_ExtentY = 5953
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Begin VB.CommandButton ComdPrint
Caption = "打印"
Height = 375
Left = 480
TabIndex = 4
Top = 4440
Width = 735
End
Begin VB.CommandButton ComdQuery
Caption = "
查询"
Height = 375
Left = 7080
TabIndex = 3
Top = 120
Width = 735
End
Begin VB.CommandButton ComdCancel
Caption = "取消"
Height = 375
Left = 7080
TabIndex = 2
Top = 4440
Width = 735
End
Begin VB.ComboBox CombRID
Height = 315
Left = 1920
TabIndex = 1
Top = 180
Width = 975
End
Begin
VB.ComboBox CombRepID
Height = 315
Left = 5040
TabIndex = 0
Top = 180
Width = 1095
End
Begin VB.Label Label2
Caption = "维修单编号:"
Height = 375
Left = 3840
TabIndex = 8
Top = 240
Width = 1095
End
Begin VB.Label Label1
Caption = "房间编号:"
Height = 375
Left = 600
TabIndex = 7
Top = 240
Width = 1095
End
End
Attribute VB_Name = "FMRepairTable"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Conn As New Connection
Private Sub ComdCancel_Click()
Conn.Close
Unload Me
End Sub
Private Sub ComdQuery_Click()
Dim SqlStr As String
Dim rsRPTable As New Recordset
Dim sRoomID As String
Dim sRepairID As String
sRoomID = Trim(Me.CombRID.Text)
sRepairID = Trim(Me.CombRepID.Text)
SqlStr = "select RepairID as 维修单编号,RoomID as 房间编号" & ",Remake as 故障现象 from RepairInfo where RoomID like " & " '%" & sRoomID & "%'" & "and RepairID like '%" & sRepairID & "%'"
Set rsRPTable = Conn.Execute(SqlStr)
Set DataGrid1.DataSource = rsRPTable
Set rsRPTable = Nothing
End Sub
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2 '垂直方向居中
Me.Left = (Screen.Width - Me.Height) / 2 '水平方向居中
With Conn
Conn.CursorLocation = adUseClient
Conn.CommandTimeout = 10
Conn.ConnectionString = g_ConnStr
Conn.Open
End With
Dim SqlStr As String
Dim rsRepairTable As New Recordset
SqlStr = "select RepairID as 维修单编号,RoomID as 房间编号" & ",Remake as 故障现象 from RepairInfo"
Set rsRepairTable = Conn.Execute(SqlStr)
Me.DataGrid1.ColumnHeaders = True
Set DataGrid1.DataSource = rsRepairTable
Set rsRepairTable = Nothing
'从数据库中读取数据写入房间编号下拉列表框
Dim adoRs As New ADODB.Recordset
Dim DBStr As String
DBStr = "select RoomID from RoomInfo where RoomState='维修'"
adoRs.Open DBStr, Conn, adOpenStatic, adLockReadOnly
If adoRs.RecordCount > 0 Then
adoRs.MoveFirst
Do While Not adoRs.EOF
CombRID.AddItem adoRs.Fields(0).Value
adoRs.MoveNext
Loop
End If
adoRs.Close
Set adoRs = Nothing
'从数据库中读取数据写入维修单编号下拉
列表框
Dim adoRPIDRs As New ADODB.Recordset
DBStr = "select RepairID from RepairInfo"
adoRPIDRs.Open DBStr, Conn, adOpenStatic, adLockReadOnly
If adoRPIDRs.RecordCount > 0 Then
adoRPIDRs.MoveFirst
Do While Not adoRPIDRs.EOF
CombRepID.AddItem adoRPIDRs.Fields(0).Value
adoRPIDRs.MoveNext
Loop
End If
adoRPIDRs.Close
'Set adoRPIDRs = Nothing
End Sub