📄 frmaddei.frm
字号:
TabIndex = 3
Top = 720
Width = 1995
End
Begin VB.ListBox listzhunjia
Height = 3300
Left = 300
TabIndex = 2
Top = 720
Width = 2595
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "准驾车型:"
Height = 180
Left = 3480
TabIndex = 8
Top = 300
Width = 900
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "准驾车型列表:"
Height = 180
Left = 300
TabIndex = 7
Top = 300
Width = 1260
End
End
End
End
Attribute VB_Name = "frmcanshu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub listleibieShow() '刷货品类别列表
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select * from Leibie"
rs.open sql, cn
Listleibie.Clear
Do While Not rs.EOF
Listleibie.AddItem rs!leibie
rs.MoveNext
Loop
End Sub
Private Sub listpinpaiShow() '刷新货品品牌列表
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select * from pinpai"
rs.open sql, cn
ListPinpai.Clear
Do While Not rs.EOF
ListPinpai.AddItem rs!pinpai
rs.MoveNext
Loop
End Sub
Private Sub listdanweiShow() '刷新货品单位列表
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select * from danwei"
rs.open sql, cn
listdanwei.Clear
Do While Not rs.EOF
listdanwei.AddItem rs!danwei
rs.MoveNext
Loop
End Sub
Private Sub cmdadddanwei_Click() '添加货品单位
Dim rs As New ADODB.Recordset
Dim sql As String
Dim strdanwei As String
strdanwei = Trim(txtdanwei.Text)
If strdanwei = "" Then
MsgBox "请输入货品单位", 48, "提示信息"
txtdanwei.SetFocus
Exit Sub
End If
If Len(strdanwei) > 20 Then
MsgBox "您输入的货品单位名过长,请重新输入.", 48, "提示信息"
txtdanwei.SetFocus
Exit Sub
End If
sql = "select * from danwei where danwei='" & strdanwei & "'"
rs.open sql, cn, adOpenDynamic, adLockOptimistic
If rs.RecordCount > 0 Then
MsgBox "已经存在货品单位[" & strdanwei & "]", 48, "提示信息"
txtdanwei.SetFocus
Exit Sub
End If
rs.AddNew
rs!danwei = strdanwei
rs.Update
txtdanwei = ""
txtdanwei.SetFocus
listdanweiShow
End Sub
Private Sub cmdAddPinpai_Click() '添加货品品牌
Dim rs As New ADODB.Recordset
Dim sql As String
Dim strpinpai As String
strpinpai = Trim(txtPinpai.Text)
If strpinpai = "" Then
MsgBox "请输入货品品牌", 48, "提示信息"
txtPinpai.SetFocus
Exit Sub
End If
If Len(strpinpai) > 20 Then
MsgBox "您输入的品牌名过长,请重新输入.", 48, "提示信息"
txtPinpai.SetFocus
Exit Sub
End If
sql = "select * from pinpai where pinpai='" & strpinpai & "'"
rs.open sql, cn, adOpenDynamic, adLockOptimistic
If rs.RecordCount > 0 Then
MsgBox "已经存在货品品牌[" & strpinpai & "]", 48, "提示信息"
txtPinpai.SetFocus
Exit Sub
End If
rs.AddNew
rs!pinpai = strpinpai
rs.Update
txtPinpai = ""
txtPinpai.SetFocus
listpinpaiShow
End Sub
Private Sub cmdAddleibie_Click() '添加货品类别
Dim rs As New ADODB.Recordset
Dim strleibie As String
Dim sql As String
strleibie = Trim(txtleibie.Text)
If strleibie = "" Then
MsgBox "请输入货品类别。", 48, "提示信息"
txtleibie.SetFocus
Exit Sub
End If
If Len(strleibie) > 20 Then
MsgBox "您输入货品类别名称过长,请重新输入。", 48, "提示信息"
txtleibie.SetFocus
Exit Sub
End If
sql = "select * from leibie where leibie='" & strleibie & "'"
rs.open sql, cn, adOpenDynamic, adLockOptimistic
If rs.RecordCount > 0 Then
MsgBox "已经存在货品类别[" & strleibie & "],请重新输入。", 48, "提示信息"
txtleibie.SetFocus
Exit Sub
End If
rs.AddNew
rs!leibie = strleibie
rs.Update
txtleibie.Text = ""
txtleibie.SetFocus
listleibieShow
End Sub
Private Sub cmdclosebaoxian_Click()
Unload Me
End Sub
Private Sub cmdclosedanwei_Click()
Unload Me
End Sub
Private Sub cmdcloseleibie_Click()
Unload Me
End Sub
Private Sub cmdclosepinpai_Click()
Unload Me
End Sub
Private Sub cmdclosezhunjia_Click()
Unload Me
End Sub
Private Sub cmdDelPinpai_Click() '删除货品品牌
Dim str As String
Dim sql As String
Dim strpinpai As String
If ListPinpai.List(ListPinpai.ListIndex) = "" Then
MsgBox "请选择列表中的品牌", 48, "提示信息"
Exit Sub
End If
strpinpai = ListPinpai.List(ListPinpai.ListIndex)
str = "您确实要删除货品品牌[" & strpinpai & "]吗?"
If MsgBox(str, 36, "警告") = vbNo Then Exit Sub
sql = "delete from pinpai where pinpai='" & strpinpai & "'"
cn.Execute sql
listpinpaiShow
End Sub
Private Sub cmddelleibie_Click() '删除货品类别
Dim str As String
Dim strleibie As String
Dim sql As String
If Listleibie.ListIndex = -1 Then
MsgBox "请选中类别列表中的货品类别。", 48, "提示信息"
Exit Sub
End If
strleibie = Listleibie.List(Listleibie.ListIndex)
str = "您确实要删除货品类别[" & strleibie & "]吗?"
If MsgBox(str, 36, "警告") = vbNo Then Exit Sub
sql = "delete from leibie where leibie='" & strleibie & "'"
cn.Execute sql
listleibieShow
End Sub
Private Sub Form_Load()
listpinpaiShow
listleibieShow
listdanweiShow
End Sub
Private Sub txtdanwei_KeyPress(KeyAscii As Integer)
If Trim(txtdanwei.Text) <> "" And KeyAscii = 13 Then
cmdadddanwei.SetFocus
Exit Sub
End If
End Sub
Private Sub txtleibie_KeyPress(KeyAscii As Integer)
If Trim(txtleibie.Text) <> "" And KeyAscii = 13 Then
cmdaddleibie.SetFocus
Exit Sub
End If
End Sub
Private Sub txtPinpai_KeyPress(KeyAscii As Integer)
If Trim(txtPinpai.Text) <> "" And KeyAscii = 13 Then
cmdAddPinpai.SetFocus
Exit Sub
End If
End Sub
Private Sub cmddeldanwei_Click() '删除货品单位
Dim str As String
Dim sql As String
Dim strdanwei As String
If listdanwei.List(listdanwei.ListIndex) = "" Then
MsgBox "请选择列表中的单位", 48, "提示信息"
Exit Sub
End If
strdanwei = listdanwei.List(listdanwei.ListIndex)
str = "您确实要删除货品单位[" & strdanwei & "]吗?"
If MsgBox(str, 36, "警告") = vbNo Then Exit Sub
sql = "delete from danwei where danwei='" & strdanwei & "'"
cn.Execute sql
listdanweiShow
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -