📄 frmaccessoryedit.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmAccessorySel
Caption = "选择设备配件"
ClientHeight = 2790
ClientLeft = 60
ClientTop = 345
ClientWidth = 7575
LinkTopic = "Form1"
ScaleHeight = 2790
ScaleWidth = 7575
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtCount
Height = 330
Left = 1080
TabIndex = 5
Text = "1"
Top = 2280
Width = 975
End
Begin MSAdodcLib.Adodc AdoAccessory
Height = 375
Left = 4560
Top = 120
Visible = 0 'False
Width = 2655
_ExtentX = 4683
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoAccessory"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Cmd_DeviceSel
Caption = "选择配件"
Height = 375
Left = 120
TabIndex = 2
Top = 120
Width = 1000
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 375
Left = 3600
TabIndex = 1
Top = 2280
Width = 1000
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取 消"
Height = 375
Left = 5280
TabIndex = 0
Top = 2280
Width = 1000
End
Begin MSDataGridLib.DataGrid db_Accessory
Height = 1455
Left = 120
TabIndex = 3
Top = 600
Width = 7335
_ExtentX = 12938
_ExtentY = 2566
_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
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "数量"
Height = 180
Left = 360
TabIndex = 4
Top = 2355
Width = 360
End
End
Attribute VB_Name = "FrmAccessorySel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean '插入=false,修改=true
Public sDevId As String '配件编号
Public DId As Long '分配编号
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_DeviceSel_Click()
'选择配件
FrmDeviceSel.nFlag = 2
FrmDeviceSel.Caption = "选择设备配件"
FrmDeviceSel.Show 1
'读取指定对象信息
sDevId = Trim(MyDeviceSel.Id)
AccessoryRefresh
End Sub
Private Sub AccessoryRefresh()
AdoAccessory.ConnectionString = Conn
AdoAccessory.RecordSource = "SELECT d.Id AS 编号,d.Name AS 配件名称," _
+ "d.Model AS 配件型号,t.TypeName AS 分类," _
+ "d.Unit AS 单位,d.DCount AS 数量 " _
+ " FROM Device d,Types t WHERE d.TypeId=t.Id " _
+ " AND d.Id='" + sDevId + "'"
AdoAccessory.Refresh
Set db_Accessory.DataSource = AdoAccessory
db_Accessory.Columns(0).Width = 800
db_Accessory.Columns(1).Width = 1400
db_Accessory.Columns(2).Width = 1400
db_Accessory.Columns(3).Width = 1200
db_Accessory.Columns(4).Width = 800
db_Accessory.Columns(5).Width = 800
End Sub
Private Sub Cmd_OK_Click()
'检查用户录入数据的有效性
If Len(Trim(sDevId)) = 0 Then
MsgBox "请选择设备"
Cmd_DeviceSel.SetFocus
Exit Sub
End If
If Len(Trim(txtCount)) = 0 Or Val(txtCount) <= 0 Then
MsgBox ("请输入分配数量,分配数量大于0")
txtCount.SetFocus
Exit Sub
End If
'把用户录入的数据赋值到数据库对象变量中
With MyAList
.DevId = sDevId
.ACount = Val(txtCount)
.DisId = DId
.Insert
End With
'关闭窗口
Unload Me
End Sub
Private Sub Form_Load()
AccessoryRefresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -