📄 main_jbzl_yp_addormodify.frm
字号:
VERSION 5.00
Begin VB.Form main_jbzl_yp_AddorModify
BorderStyle = 1 'Fixed Single
ClientHeight = 4635
ClientLeft = 45
ClientTop = 330
ClientWidth = 8250
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4635
ScaleWidth = 8250
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 405
Left = 2190
TabIndex = 19
Top = 4095
Width = 1695
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 405
Left = 4050
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 = 1050
TabIndex = 4
Top = 1815
Width = 4620
End
Begin VB.TextBox Text1
Height = 330
Index = 5
Left = 1050
TabIndex = 3
Top = 2325
Width = 4620
End
Begin VB.TextBox Text1
Height = 330
Index = 6
Left = 1065
TabIndex = 2
Top = 2850
Width = 3420
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 330
Index = 7
Left = 1065
TabIndex = 1
Text = "0"
Top = 3360
Width = 3420
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 = "商品编号"
Height = 300
Index = 8
Left = 180
TabIndex = 10
Top = 390
Width = 750
End
Begin VB.Label lblbh
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 225
Left = 1020
TabIndex = 9
Top = 360
Width = 615
End
End
End
Attribute VB_Name = "main_jbzl_yp_AddorModify"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:main_jbzl_yp_AddorModify
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'** 业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'** 下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'** 不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网 址:www.mingrisoft.com 价值无限,服务无限
'**电 话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日 期:2007-10-31
'**修 改 人:MRLBB
'**日 期:2007-10-31
'**描 述:
'*************************************************************************
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
rs.Open "tb_kc order by 商品编号", Cnn, adOpenKeyset, adLockOptimistic
Dim i As Integer
If blnModify = False Then
Me.Caption = "药品新增"
Else
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
End If
rs.Close
End Sub
Private Sub Text1_Change(Index As Integer)
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 Sub
Private Sub Text1_GotFocus(Index As Integer)
text1(Index).BackColor = &HFFFF80
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 < 7 Then text1(Index + 1).SetFocus '回车获得焦点
If KeyCode = vbKeyReturn And Index = 7 Then CmdOk.SetFocus
If KeyCode = vbKeyUp And Index > 1 Then text1(Index - 1).SetFocus
End Sub
Private Sub cmdOK_Click()
If IsNumeric(text1(5)) = False Then
MsgBox "包装必须为数字!"
text1(5).SetFocus
Exit Sub
End If
Dim r As Integer, c As Integer, i As Integer
Select Case LngMedicine
Case 1
Cnn.Execute ("update tb_kc set 商品名称='" + text1(0).Text + "',简称='" + text1(1) + "',批号='" + text1(2) + _
"',产地='" + text1(3) + "',规格='" + text1(4) + "',包装=" + text1(5) + ",单位='" + text1(6) + "' where 商品编号=" + lblbh.Caption + "")
Case 2
Cnn.Execute ("insert into tb_kc(商品名称,简称,批号,产地,规格,包装,单位) values('" + text1(0) + "','" + _
text1(1) + "','" + text1(2) + "','" + text1(3) + "','" + text1(4) + "'," + text1(5) + ",'" + text1(6) + "'")
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 selectsql <> "" Then
Adodc1.RecordSource = "select * from tb_kc where " & selectsql
Adodc1.Refresh
Else
Adodc1.RecordSource = "select * from tb_kc"
Adodc1.Refresh
End If
End Select
With main_jbzl_yp.Flex1
.Clear
rs.Open "tb_kc order by 商品编号", Cnn, adOpenKeyset, adLockOptimistic
Set .DataSource = rs
.Visible = False
.AllowBigSelection = True
.BackColorSel = vbGreen
.ForeColorSel = vbRed
.ColWidth(0) = 200
.ColWidth(9) = 0
.ColWidth(12) = 0
.ColWidth(11) = 0
For r = 1 To .Rows - 1 Step 2
For c = 1 To .Cols - 1
.Row = r
.Col = c
.CellBackColor = &HC0E0FF
Next c
Next r
.Visible = True
rs.Close
End With
Unload Me
End Sub
Private Sub cmdCancel_Click()
Load main_jbzl_yp
main_jbzl_yp.Show
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -