?? 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 + -