📄 frm_xhxx.frm
字号:
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "名称"
ForeColor = &H00C00000&
Height = 255
Left = 3360
TabIndex = 12
Top = 240
Width = 615
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3840
Top = 1560
Width = 1455
_ExtentX = 2566
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Data_cggl;Data Source=服务器"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Data_cggl;Data Source=服务器"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "sa"
Password = ""
RecordSource = "select * from table_xhb"
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.TextBox Text8
Height = 375
Left = 4440
TabIndex = 26
Text = "Text8"
Top = 4440
Width = 735
End
Begin VB.Frame Frame1
Height = 735
Left = 0
TabIndex = 0
Top = 0
Width = 7935
Begin VB.CommandButton Cmd_cancel
Caption = "取消"
Height = 345
Left = 3960
TabIndex = 8
Top = 240
Width = 855
End
Begin VB.CommandButton Cmd_add
Caption = "增加"
Height = 350
Left = 120
TabIndex = 7
Top = 240
Width = 855
End
Begin VB.CommandButton Cmd_del
Caption = "删除"
Height = 350
Left = 1080
TabIndex = 6
Top = 240
Width = 855
End
Begin VB.CommandButton Cmd_edit
Caption = "修改"
Enabled = 0 'False
Height = 350
Left = 2040
TabIndex = 5
Top = 240
Width = 855
End
Begin VB.CommandButton Cmd_exit
Caption = "关闭"
Height = 350
Left = 6840
TabIndex = 4
Top = 240
Width = 855
End
Begin VB.CommandButton Cmd_save
Caption = "保存"
Enabled = 0 'False
Height = 350
Left = 3000
TabIndex = 3
Top = 240
Width = 855
End
Begin VB.CommandButton Cmd_refurbish
Caption = "刷新"
Height = 350
Left = 4920
TabIndex = 2
Top = 240
Width = 855
End
Begin VB.CommandButton Cmd_query
Caption = "查询"
Height = 350
Left = 5880
TabIndex = 1
Top = 240
Width = 855
End
End
Begin VB.Frame Frame3
Height = 735
Left = 0
TabIndex = 14
Top = 0
Width = 7935
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frm_xhxx.frx":007E
Left = 1080
List = "frm_xhxx.frx":0088
Style = 2 'Dropdown List
TabIndex = 19
Top = 240
Width = 1695
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "frm_xhxx.frx":00A0
Left = 2880
List = "frm_xhxx.frx":00B6
Style = 2 'Dropdown List
TabIndex = 18
Top = 240
Width = 975
End
Begin VB.TextBox Text10
Height = 300
Left = 3960
TabIndex = 17
Top = 240
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 350
Left = 5880
TabIndex = 16
Top = 200
Width = 855
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 350
Left = 6840
TabIndex = 15
Top = 200
Width = 855
End
Begin VB.Label Label10
Caption = "查询条件"
ForeColor = &H00808000&
Height = 195
Left = 120
TabIndex = 20
Top = 320
Width = 975
End
End
End
Attribute VB_Name = "frm_xhxx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim c, i, a
Private Sub cmd_add_Click()
Text1.Text = ""
Text2.Text = ""
Text7.Text = ""
DataCombo2.Text = ""
DataCombo3.Text = ""
DataCombo4.Text = ""
DataCombo5.Text = ""
DataCombo6.Text = ""
Text1.Locked = True
cmd_save.Enabled = True
cmd_add.Enabled = False
Dim temp1
'tem1=format(now,"yyyymmdd")
Adodc1.RecordSource = "select * from table_xhb order by 型号编号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text1.Text = Adodc1.Recordset.Fields("型号编号")
Text1.Text = Val(Adodc1.Recordset.Fields("型号编号")) + 1
Else
Text1.Text = 1000
End If
Adodc1.RecordSource = "select * from table_xhb order by 型号编号"
Adodc1.Refresh
End Sub
Private Sub Cmd_cancel_Click()
Text1.Locked = False
cmd_del.Enabled = False
cmd_save.Enabled = False
cmd_add.Enabled = True
cmd_edit.Enabled = False
End Sub
Private Sub Cmd_del_Click()
Adodc1.RecordSource = "select * from table_xhb"
'adodc1.refresh
If Adodc1.Recordset.RecordCount > 0 Then
c = MsgBox("确认要删除该信息吗?", 17, "采购管理系统")
If c = vbOK Then
Adodc1.Recordset.Delete
Else
End If
Else
MsgBox "数据库中的信息为空,没有可删除的信息!!", 64, "采购管理系统"
End If
Call main
adoCon.CursorLocation = adUseClient
Set adoRs = adoCon.OpenSchema(adSchemaTables)
adoRs.Find (" table_name = '" & frm_jgxx.Text1 & "'")
If adoRs.EOF Then
MsgBox "没有价格信息"
Else
c = MsgBox("删除价格信息?", 33, "采购管理系统")
If c = vbOK Then
Set adoRs = adoCon.Execute(" drop table " & frm_jgxx.Text1 & "")
End If
End If
adoCon.Close
End Sub
Private Sub cmd_edit_Click()
Call main
c = MsgBox("确认要修改改信息吗?", 33, "采购管理系统")
If c = vbOK Then
Adodc1.Recordset.Delete
Set adoRs = adoCon.Execute(" insert into table_xhb values(" & Text1 & ",'" & Text2 & "','" & Text7 & "','" & DataCombo2 & "','" & DataCombo3 & "','" & DataCombo4 & "','" & DataCombo5 & "','" & DataCombo6 & "','" & Text6 & "')")
MsgBox "数据修改成功!!", 64, "采购管理系统"
cmd_edit.Enabled = False
Else
End If
adoCon.Close
End Sub
Private Sub Cmd_exit_Click()
Unload Me
End Sub
Private Sub Cmd_query_Click()
Frame1.Visible = False
Frame3.Visible = True
End Sub
Private Sub Cmd_refurbish_Click()
Unload Me
frm_xhxx.Refresh
frm_xhxx.Show
End Sub
Private Sub Cmd_save_Click()
Call main
Adodc1.RecordSource = "select *from table_xhb where 型号编号='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
c = MsgBox("确认保存该信息吗?", 33, "采购管理系统")
If c = vbOK Then
Set adoRs = adoCon.Execute(" insert into table_xhb values(" & Text1 & ",'" & Text2 & "','" & Text7 & "','" & DataCombo2 & "','" & DataCombo3 & "','" & DataCombo4 & "','" & DataCombo5 & "','" & DataCombo6 & "','" & Text6 & "')")
MsgBox "数据保存成功!!", 32, "采购管理系统"
cmd_save.Enabled = False
If cmd_add.Enabled = False Then cmd_add.Enabled = True
Else
End If
Else
MsgBox "对不起,该信息已经保存过,不能够再进行保存", 64, "采购管理系统"
End If
Adodc1.RecordSource = "select * from Table_xhb order by 型号编号"
Adodc1.Refresh
adoCon.Close
End Sub
Private Sub Command1_Click()
If Combo1.Text = "" Or Combo2.Text = "" Or Text10.Text = "" Then
MsgBox "输入或选择的内容不能为空值", 48, "采购管理系统"
ElseIf Combo1.Text = "型号编号" Then
If Not IsNumeric(Text10.Text) Then
Text10.Text = ""
Text10.SetFocus
Else
a = Text10.Text
If i = 0 Then
Adodc1.RecordSource = "select * from table_xhb where " + Combo1.Text + " " + Combo2.Text + " '" + a + " '"
Adodc1.Refresh
ElseIf i = 1 Then
Adodc1.RecordSource = "select * from table_xhb where " + Combo1.Text + " like '&" + a + "&' "
Adodc1.Refresh
Else
End If
End If
Else
a = Text10.Text
If i = 0 Then
Adodc1.RecordSource = " select * from table_xhb where " + Combo1.Text + " " + Combo2.Text + " '" + a + "'"
Adodc1.Refresh
ElseIf i = 1 Then
Adodc1.RecordSource = " select * from table_xhb where " + Combo1.Text + " like '&" + a + "&'"
Adodc1.Refresh
Else
End If
End If
End Sub
Private Sub Command2_Click()
Frame1.Visible = True
Frame3.Visible = False
End Sub
Private Sub Command3_Click()
frm_jgxx.Show
frm_jgxx.Text1 = "table_jg" + Text1.Text
frm_jgxx.Text2 = Text2.Text
frm_jgxx.Text5 = Text1.Text
End Sub
Private Sub DataCombo1_Click(Area As Integer)
End Sub
Private Sub DataGrid1_Click()
If cmd_edit.Enabled = False Then cmd_edit.Enabled = True
Adodc1.RecordSource = "select * from table_xhb where 型号编号='" + Text8.Text + "'"
'adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1.Text = Adodc1.Recordset.Fields("型号编号")
Text2.Text = Adodc1.Recordset.Fields("型号名称")
Text7.Text = Adodc1.Recordset.Fields("备注")
DataCombo2.Text = Adodc1.Recordset.Fields("供应商1")
DataCombo3.Text = Adodc1.Recordset.Fields("供应商2")
DataCombo4.Text = Adodc1.Recordset.Fields("供应商3")
DataCombo5.Text = Adodc1.Recordset.Fields("供应商4")
DataCombo6.Text = Adodc1.Recordset.Fields("供应商5")
Text6.Text = Adodc1.Recordset.Fields("市场价")
Else
End If
frm_jgxx.Text1 = "table_jg" + Text1.Text
frm_jgxx.Text2 = Text2.Text
frm_jgxx.Text5 = Text1.Text
End Sub
Private Sub Form_Load()
'SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
' 将窗口设为总在最前
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Text6.Text = ""
DataCombo2.Text = ""
DataCombo3.Text = ""
DataCombo4.Text = ""
DataCombo5.Text = ""
DataCombo6.Text = ""
frm_main.StatusBar1.Panels(1).Text = " 当前操作: " & Me.Caption
Adodc1.RecordSource = "select * from table_xhb order by 型号编号"
Adodc1.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.StatusBar1.Panels(1).Text = ""
End Sub
Private Sub Label6_Click()
End Sub
Private Sub Text6_Change()
frm_jgxx.Text6.Text = Text6.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -