📄 frmmodifymeteral.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 frmModifyMeteral
BorderStyle = 1 'Fixed Single
Caption = "原料供应信息"
ClientHeight = 6225
ClientLeft = 45
ClientTop = 330
ClientWidth = 9585
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6225
ScaleWidth = 9585
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancle
Caption = "关闭"
Height = 375
Left = 7920
TabIndex = 6
Top = 5520
Width = 1095
End
Begin VB.CommandButton cmdDel
Caption = "删除"
Height = 375
Left = 6480
TabIndex = 5
Top = 5520
Width = 1095
End
Begin VB.CommandButton cmdEdit
Caption = "修改"
Height = 375
Left = 7920
TabIndex = 4
Top = 4800
Width = 1095
End
Begin VB.CommandButton cmdAdd
Caption = "增加"
Height = 375
Left = 6480
TabIndex = 3
Top = 4800
Width = 1095
End
Begin VB.TextBox txtPinPai
Height = 320
Left = 7320
TabIndex = 2
Top = 1560
Width = 1695
End
Begin VB.TextBox txtProvider
Height = 320
Left = 7320
TabIndex = 1
Top = 960
Width = 1695
End
Begin VB.ComboBox comboMeteralName
Height = 300
ItemData = "frmModifyMeteral.frx":0000
Left = 7320
List = "frmModifyMeteral.frx":0010
TabIndex = 0
Top = 360
Width = 1695
End
Begin MSDataGridLib.DataGrid DataGridArg
Height = 5535
Left = 120
TabIndex = 7
Top = 120
Width = 5535
_ExtentX = 9763
_ExtentY = 9763
_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 MSAdodcLib.Adodc adodcArg
Height = 330
Left = 120
Top = 5760
Width = 5535
_ExtentX = 9763
_ExtentY = 582
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 = ""
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.Label Label3
Caption = "品牌"
Height = 255
Left = 6240
TabIndex = 10
Top = 1680
Width = 615
End
Begin VB.Label Label2
Caption = "供应商"
Height = 255
Left = 6240
TabIndex = 9
Top = 960
Width = 615
End
Begin VB.Label Label1
Caption = "原料名称"
Height = 255
Left = 6240
TabIndex = 8
Top = 360
Width = 735
End
End
Attribute VB_Name = "frmModifyMeteral"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private editmode As Boolean
Private Function IsFuHeYaoQiu() As Boolean
IsFuHeYaoQiu = True
If comboMeteralName.Text = "" Or txtProvider.Text = "" Or txtPinPai.Text = "" Then
IsFuHeYaoQiu = False
End If
If editmode = False Then '增加状态时要判断是否重复
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
rs.Open "select * from 原料供应表 where 原料名称 = '" & comboMeteralName & "' and 供应商 = '" & txtProvider.Text & "' and 品牌 = '" & txtPinPai.Text & "'"
If rs.EOF = False Then
IsFuHeYaoQiu = False
End If
rs.Close
cn.Close
End If
End Function
Private Sub cmdAdd_Click()
If IsFuHeYaoQiu = False Then
MsgBox "请输入合适的的值!", , "提示信息"
Exit Sub
End If
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
If editmode Then
rs.Open "select * from 原料供应表 where 原料名称 = '" & comboMeteralName & "' and 供应商 = '" & txtProvider.Text & "' and 品牌 = '" & txtPinPai.Text & "'"
Else
rs.Open "select * from 原料供应表"
rs.AddNew
End If
rs!原料名称 = comboMeteralName.Text
rs!供应商 = txtProvider.Text
rs!品牌 = txtPinPai.Text
rs.Update
rs.Close
cn.Close
DataGridArg.AllowUpdate = True
SetDataGrid
If editmode = True Then
cmdAdd.Caption = "增加"
cmdEdit.Enabled = True
cmdDel.Caption = "删除"
End If
comboMeteralName.Text = ""
txtProvider.Text = ""
txtPinPai.Text = ""
End Sub
Private Sub AdodcArg_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If AdodcArg.Recordset.BOF Or AdodcArg.Recordset.EOF Then
AdodcArg.Caption = "记录:0"
Else
AdodcArg.Caption = "记录:" & (AdodcArg.Recordset.AbsolutePosition)
End If
End Sub
Private Sub SetDataGrid()
AdodcArg.ConnectionString = connectString
AdodcArg.RecordSource = "select 原料名称,供应商,品牌 from 原料供应表"
Set DataGridArg.DataSource = AdodcArg
AdodcArg.Refresh
End Sub
Private Sub cmdCancle_Click()
Unload Me
End Sub
Private Sub cmdDel_Click()
If cmdDel.Caption = "删除" Then
If AdodcArg.Recordset.EOF Or AdodcArg.Recordset.BOF Then
MsgBox "当前记录为空,不允许删除!", , "提示信息"
Exit Sub
End If
DataGridArg.AllowDelete = True
If MsgBox("确实要删除当前记录吗?", vbYesNo, "提示信息") = vbYes Then
AdodcArg.Recordset.Delete
If AdodcArg.Recordset.EOF = False Then
AdodcArg.Recordset.MoveNext
End If
DataGridArg.AllowDelete = False
End If
Else '当取消来用
cmdAdd.Caption = "增加"
cmdDel.Caption = "删除"
DataGridArg.AllowDelete = False
cmdAdd.Enabled = True
cmdEdit.Enabled = True
comboMeteralName.Text = ""
txtProvider.Text = ""
txtPinPai.Text = ""
End If
End Sub
Private Sub cmdEdit_Click()
If AdodcArg.Recordset.EOF Or AdodcArg.Recordset.BOF Then
MsgBox "当前记录为空,不能修改!", , "提示"
Exit Sub
Else
comboMeteralName.Text = AdodcArg.Recordset!原料名称
txtProvider.Text = AdodcArg.Recordset!供应商
txtPinPai.Text = AdodcArg.Recordset!品牌
End If
cmdDel.Caption = "取消"
cmdEdit.Enabled = False
cmdAdd.Caption = "保存"
cmdDel.Caption = "取消"
editmode = True
End Sub
Private Sub comboMeteralName_Click()
txtProvider.SetFocus
End Sub
Private Sub Form_Load()
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockReadOnly
rs.CursorType = adOpenForwardOnly
rs.Open "select 规格值 from 规格表 where 名称 = '其它原料' and 规格名称 = '原料名称'"
Do Until rs.EOF
comboMeteralName.AddItem rs!规格值
rs.MoveNext
Loop
rs.Close
cn.Close
SetDataGrid
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -