📄 frmpngl.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 frmpnb
Caption = " P/N管理"
ClientHeight = 4935
ClientLeft = 60
ClientTop = 345
ClientWidth = 7560
LinkTopic = "Form1"
ScaleHeight = 4935
ScaleWidth = 7560
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adopnb
Height = 345
Left = 60
Top = 4290
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 609
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 = "Adodc1"
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 cmdclose
Caption = "退出"
Height = 350
Left = 5160
TabIndex = 14
Top = 4380
Width = 900
End
Begin VB.CommandButton cmdsearch
Caption = "查找"
Height = 350
Left = 4125
TabIndex = 13
Top = 4380
Width = 900
End
Begin VB.CommandButton cmddel
Caption = "删除"
Height = 350
Left = 3090
TabIndex = 12
Top = 4380
Width = 900
End
Begin VB.CommandButton cmdedit
Caption = "修改"
Height = 350
Left = 2055
TabIndex = 11
Top = 4380
Width = 900
End
Begin VB.CommandButton cmdadd
Caption = "添加"
Height = 350
Left = 1020
TabIndex = 10
Top = 4380
Width = 900
End
Begin VB.TextBox pnh
DataField = "安标"
DataSource = "Adopnb"
Height = 320
Left = 3570
TabIndex = 9
Text = "Text5"
Top = 630
Width = 1300
End
Begin VB.TextBox sztb
DataField = "图标"
DataSource = "Adopnb"
Height = 320
Left = 1230
TabIndex = 8
Text = "Text4"
Top = 630
Width = 1300
End
Begin VB.TextBox fhtb
DataField = "图标2"
DataSource = "Adopnb"
Height = 320
Left = 6030
TabIndex = 7
Text = "Text3"
Top = 150
Width = 1300
End
Begin VB.TextBox xh
DataField = "型号"
DataSource = "Adopnb"
Height = 320
Left = 3570
TabIndex = 6
Text = "Text2"
Top = 150
Width = 1300
End
Begin VB.TextBox khbm
DataField = "客户编码"
DataSource = "Adopnb"
Height = 320
Left = 1230
TabIndex = 5
Text = "Text1"
Top = 150
Width = 1300
End
Begin MSDataGridLib.DataGrid DataGrid2
Bindings = "frmpngl.frx":0000
Height = 3075
Left = 600
TabIndex = 15
Top = 1140
Width = 6315
_ExtentX = 11139
_ExtentY = 5424
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1.4
RowHeight = 15
FormatLocked = -1 'True
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 = 7
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
BeginProperty Column02
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 Column03
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 Column04
DataField = "图标2"
Caption = "符号图标"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column05
DataField = "PN号"
Caption = "PN号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column06
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
Object.Visible = 0 'False
ColumnWidth = 2085.166
EndProperty
BeginProperty Column01
Object.Visible = 0 'False
ColumnWidth = 2085.166
EndProperty
BeginProperty Column02
ColumnWidth = 1500.095
EndProperty
BeginProperty Column03
ColumnWidth = 1200.189
EndProperty
BeginProperty Column04
ColumnWidth = 1200.189
EndProperty
BeginProperty Column05
Object.Visible = 0 'False
ColumnWidth = 2085.166
EndProperty
BeginProperty Column06
ColumnWidth = 1365.165
EndProperty
EndProperty
End
Begin VB.Label Label6
Caption = "安标简称:"
Height = 315
Left = 2700
TabIndex = 16
Top = 690
Width = 1005
End
Begin VB.Label Label5
Caption = "PN号:"
Height = 300
Left = 6390
TabIndex = 4
Top = 4380
Visible = 0 'False
Width = 795
End
Begin VB.Label Label4
Caption = "符号图标:"
Height = 300
Left = 5130
TabIndex = 3
Top = 210
Width = 1005
End
Begin VB.Label Label3
Caption = "数字图标:"
Height = 300
Left = 330
TabIndex = 2
Top = 690
Width = 1005
End
Begin VB.Label Label2
Caption = "型号:"
Height = 300
Left = 3060
TabIndex = 1
Top = 210
Width = 795
End
Begin VB.Label Label1
Caption = "客户编码:"
Height = 300
Left = 330
TabIndex = 0
Top = 210
Width = 1005
End
End
Attribute VB_Name = "frmpnb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rsTemp As ADODB.Recordset
Private Sub CmdClose_Click()
Unload Me
End Sub
Private Sub cmddel_Click()
On Error Resume Next
If Adopnb.Recordset.RecordCount > 0 Then
If MsgBox("确定要删除该记录吗?", 4 + 32, "删除确认") = 6 Then
Adopnb.Recordset.Delete
Adopnb.Recordset.MoveNext
If Adopnb.Recordset.RecordCount > 0 Then Adopnb.Recordset.MoveLast
End If
Else
MsgBox "记录已为空!", 0 + 64, "信息窗"
End If
End Sub
Private Sub cmdEdit_Click()
On Error Resume Next
If cmdedit.Caption = "修改" Then
khbm.Enabled = True
xh.Enabled = True
fhtb.Enabled = True
sztb.Enabled = True
pnh.Enabled = True
varMark = Adopnb.Recordset.Bookmark '记下当前记录的位置
cmdedit.Caption = "保存"
Exit Sub
End If
If cmdedit.Caption = "保存" Then
Adopnb.Recordset.Update
Adopnb.Recordset.Requery
Adopnb.Recordset.Bookmark = varMark
khbm.Enabled = False
xh.Enabled = False
fhtb.Enabled = False
sztb.Enabled = False
pnh.Enabled = False
cmdedit.Caption = "修改"
Exit Sub
End If
If cmdedit.Caption = "取消" Then
Adopnb.Recordset.Delete
cmdedit.Caption = "修改"
Exit Sub
End If
End Sub
Private Sub cmdadd_Click()
On Error Resume Next
If cmdadd.Caption = "添加" Then
Adopnb.Recordset.AddNew
khbm.Enabled = True
xh.Enabled = True
fhtb.Enabled = True
sztb.Enabled = True
pnh.Enabled = True
khbm.SetFocus
cmdadd.Caption = "保存"
cmdedit.Caption = "取消"
Else
' If Trim(khbm.Text) = "" Then
' MsgBox "客户编码不能为空!", 0 + 16, "提示窗"
' Exit Sub
' End If
If Trim(xh.Text) = "" Then
MsgBox "型号不能为空!", 0 + 16, "提示窗"
Exit Sub
End If
rsTemp.Close
rsTemp.Open "select * from PN表 where 客户编码='" & Trim(khbm.Text) & "' and 型号='" & Trim(xh.Text) & "'", cnSys
If rsTemp.RecordCount > 0 Then
MsgBox "该客户编码与型号相关记录已存在,请认真检查!", 0 + 16, "提示窗"
cmdedit.Caption = "取消"
cmdadd.Caption = "添加"
Exit Sub
End If
Adopnb.Recordset.Update
Adopnb.Recordset.Requery '该语句非常重要,否则 Update 将出错
khbm.Enabled = False
xh.Enabled = False
fhtb.Enabled = False
sztb.Enabled = False
pnh.Enabled = False
cmdadd.Caption = "添加"
cmdedit.Caption = "修改"
End If
End Sub
Private Sub cmdSearch_Click()
On Error Resume Next
tabname = "PN表"
If cmdsearch.Caption = "查找" Then
frmSearch.Show vbModal
If strQuery <> "" Then
Adopnb.RecordSource = strQuery
Adopnb.Refresh
cmdsearch.Caption = "重置"
End If
Else
strQuery = "Select * From " & tabname
Adopnb.RecordSource = strQuery
Adopnb.Refresh
cmdsearch.Caption = "查找"
End If
End Sub
Private Sub Form_Load()
Dim pnxhtemp As String
On Error Resume Next
pnxhtemp = "无"
Set rsTemp = New ADODB.Recordset '初始化数据库
rsTemp.CursorType = adOpenKeyset
rsTemp.CursorLocation = adUseClient
rsTemp.LockType = adLockOptimistic
rsTemp.Open "select * from PN表 where 型号='" & pnxhtemp & "'", cnSys
Adopnb.ConnectionString = strConn
Adopnb.RecordSource = "Select * From PN表"
Adopnb.Refresh
khbm.Enabled = False
xh.Enabled = False
fhtb.Enabled = False
sztb.Enabled = False
pnh.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -