📄 main_jbzl_yp_window.frm
字号:
VERSION 5.00
Begin VB.Form main_jbzl_yp_window
ClientHeight = 4635
ClientLeft = 60
ClientTop = 345
ClientWidth = 8295
Icon = "main_jbzl_yp_window.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4635
ScaleWidth = 8295
StartUpPosition = 2 '屏幕中心
Tag = "编辑药品信息"
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 405
Left = 4635
TabIndex = 19
Top = 4095
Width = 1695
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 405
Left = 6495
TabIndex = 18
Top = 4095
Width = 1695
End
Begin VB.Frame Frame1
Caption = "商品信息"
Height = 3915
Left = 60
TabIndex = 0
Top = 60
Width = 8130
Begin VB.TextBox Text1
Height = 330
Index = 0
Left = 2595
TabIndex = 8
Top = 330
Width = 5340
End
Begin VB.TextBox Text1
Height = 330
Index = 1
Left = 1050
TabIndex = 7
Top = 795
Width = 2775
End
Begin VB.TextBox Text1
Height = 330
Index = 2
Left = 4530
TabIndex = 6
Top = 810
Width = 3420
End
Begin VB.TextBox Text1
Height = 330
Index = 3
Left = 1050
TabIndex = 5
Top = 1305
Width = 6900
End
Begin VB.TextBox Text1
Height = 330
Index = 4
Left = 1065
TabIndex = 4
Top = 1845
Width = 4245
End
Begin VB.TextBox Text1
Height = 330
Index = 5
Left = 1050
TabIndex = 3
Top = 2325
Width = 4245
End
Begin VB.TextBox Text1
Height = 330
Index = 6
Left = 1065
TabIndex = 2
Top = 2850
Width = 4245
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 330
Index = 7
Left = 1065
TabIndex = 1
Text = "0"
Top = 3360
Width = 4245
End
Begin VB.Image Image1
Height = 2055
Left = 5445
Picture = "main_jbzl_yp_window.frx":038A
Top = 1710
Width = 2445
End
Begin VB.Label Label1
Caption = "商品名称"
Height = 300
Index = 0
Left = 1725
TabIndex = 17
Top = 375
Width = 825
End
Begin VB.Label Label1
Caption = "商品简称 批号"
Height = 300
Index = 1
Left = 165
TabIndex = 16
Top = 870
Width = 4470
End
Begin VB.Label Label1
Caption = "产 地"
Height = 300
Index = 2
Left = 165
TabIndex = 15
Top = 1320
Width = 735
End
Begin VB.Label Label1
Caption = "规 格"
Height = 300
Index = 3
Left = 165
TabIndex = 14
Top = 1920
Width = 825
End
Begin VB.Label Label1
Caption = "包 装"
Height = 300
Index = 4
Left = 165
TabIndex = 13
Top = 2370
Width = 780
End
Begin VB.Label Label1
Caption = "单 位"
Height = 300
Index = 5
Left = 165
TabIndex = 12
Top = 2895
Width = 825
End
Begin VB.Label Label1
Caption = "数 量"
Height = 300
Index = 7
Left = 165
TabIndex = 11
Top = 3420
Width = 750
End
Begin VB.Label Label1
Caption = "商品编号"
ForeColor = &H000000FF&
Height = 300
Index = 8
Left = 180
TabIndex = 10
Top = 390
Width = 750
End
Begin VB.Label lblbh
BackStyle = 0 'Transparent
Height = 225
Left = 945
TabIndex = 9
Top = 360
Width = 690
End
End
End
Attribute VB_Name = "main_jbzl_yp_window"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:main_jbzl_yp_window
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'** 业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'** 下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'** 不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网 址:www.mingrisoft.com 价值无限,服务无限
'**电 话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日 期:2007-10-31
'**修 改 人:MRLBB
'**日 期:2007-10-31
'**描 述:
'*************************************************************************
Dim rs As New ADODB.Recordset
Private Sub Form_Activate()
Text1(0).SetFocus
End Sub
Private Sub Form_Load()
Dim i As Integer
Select Case LngMedicine
Case 1
Me.Caption = "商品添加"
rs.Open "select * from tb_kc order by 商品编号", Cnn, adOpenStatic
If rs.RecordCount > 0 Then
rs.MoveLast
lblbh.Caption = Format(Val(rs.Fields("商品编号")) + 1, "000000")
Else
lblbh.Caption = "000001"
End If
rs.Close
Case 2
Me.Caption = "商品修改"
For i = 0 To 6
With main_jbzl_yp.Flex1
Text1(i) = .TextMatrix(.Row, i + 2)
lblbh = .TextMatrix(.Row, 1)
Text1(7) = .TextMatrix(.Row, 10)
End With
Next i
Case 3
Label1(8).Visible = False
Me.Caption = "商品查询"
End Select
End Sub
Private Sub Text1_Change(Index As Integer)
If LngMedicine < 3 Then
Dim a, b As Integer
a = Len(Text1(0).text)
strPY = ""
For b = 1 To a
strPY = strPY & PYZH(Mid(Text1(0).text, b, 1))
Next b
Text1(1) = strPY
End If
End Sub
Private Sub text1_GotFocus(Index As Integer)
Text1(Index).BackColor = &HFFFF80
Text1(Index).SelStart = 0
Text1(Index).SelLength = Len(Text1(Index))
End Sub
Private Sub text1_LostFocus(Index As Integer)
Text1(Index).BackColor = &HFFFFFF
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Index < 6 Then Text1(Index + 1).SetFocus '回车获得焦点
If KeyCode = vbKeyReturn And Index = 6 Then cmdOK.SetFocus
If KeyCode = vbKeyUp And Index > 0 Then Text1(Index - 1).SetFocus
End Sub
Private Sub cmdOK_Click()
Dim r As Integer, c As Integer, i As Integer
Select Case LngMedicine
Case 1 '“添加”操作
If IsNumeric(Text1(5)) = False Then
MsgBox "包装必须为数字!"
Text1(5).SetFocus
Exit Sub
End If
On Error GoTo ErrorSave
Cnn.Execute ("insert into tb_kc(商品编号,商品名称,拼音码,批号,产地,规格,包装,单位,库存) values('" + lblbh + "','" + Text1(0) + "','" + _
Text1(1) + "','" + Text1(2) + "','" + Text1(3) + "','" + Text1(4) + "'," + Text1(5) + ",'" + Text1(6) + "'," + Text1(7) + ")")
main_jbzl_yp.Adodc1.Refresh
Case 2 '“修改”操作
If IsNumeric(Text1(5)) = False Then
MsgBox "包装必须为数字!"
Text1(5).SetFocus
Exit Sub
End If
On Error GoTo ErrorModity
Cnn.Execute ("update tb_kc set 商品名称='" + Text1(0).text + "',拼音码='" + Text1(1) + "',批号='" + Text1(2) + _
"',产地='" + Text1(3) + "',规格='" + Text1(4) + "',包装=" + Text1(5) + ",单位='" + Text1(6) + "'where 商品编号='" + lblbh + "'")
main_jbzl_yp.Adodc1.Refresh
Case 3 '“查询”操作
selectsql = ""
If Text1(0) <> "" Then
If selectsql <> "" Then
selectsql = "商品名称 like +'" + Text1(0) + "'+'%'and " & selectsql
Else
selectsql = "商品名称 like + '" + Text1(0) + "'+'%'"
End If
End If
If Text1(1) <> "" Then
If selectsql <> "" Then
selectsql = "拼音码 like+ '" + Text1(1) + "'+'%'and " & selectsql
Else
selectsql = "拼音码 like+ '" + Text1(1) + "'+'%'"
End If
End If
If Text1(2) <> "" Then
If selectsql <> "" Then
selectsql = "批号 like+ '" + Text1(2) + "'+'%'and " & selectsql
Else
selectsql = "批号 like+ '" + Text1(2) + "'+'%'"
End If
End If
If Text1(3) <> "" Then
If selectsql <> "" Then
selectsql = "产地 like+ '" + Text1(3) + "'+'%'and " & selectsql
Else
selectsql = "产地 like +'" + Text1(3) + "'+'%'"
End If
End If
If Text1(4) <> "" Then
If selectsql <> "" Then
selectsql = "规格 like+ '" + Text1(4) + "'+'%'and " & selectsql
Else
selectsql = "规格 like +'" + Text1(4) + "'+'%'"
End If
End If
If Text1(5) <> "" Then
If selectsql <> "" Then
selectsql = "包装 like+ '" + Text1(5) + "'+'%'and " & selectsql
Else
selectsql = "包装 like +'" + Text1(5) + "'+'%'"
End If
End If
If Text1(6) <> "" Then
If selectsql <> "" Then
selectsql = "单位 like+ '" + Text1(6) + "'+'%'and " & selectsql
Else
selectsql = "单位 like +'" + Text1(6) + "'+'%'"
End If
End If
If selectsql <> "" Then
main_jbzl_yp.Adodc1.RecordSource = "select * from tb_kc where " & selectsql
main_jbzl_yp.Adodc1.Refresh
Else
main_jbzl_yp.Adodc1.RecordSource = "select * from tb_kc"
main_jbzl_yp.Adodc1.Refresh
End If
End Select
With main_jbzl_yp.Flex1
.ColWidth(0) = 200
.ColWidth(9) = 0
.ColWidth(12) = 0
.ColWidth(11) = 0
End With
RegInfo Me
Unload Me
Exit Sub
ErrorSave:
MsgBox Err.Description
Exit Sub
ErrorModity:
MsgBox Err.Description
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -