📄 frm_ypmodify.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Frm_ypmodify
BorderStyle = 1 'Fixed Single
Caption = "药品修改"
ClientHeight = 5220
ClientLeft = 4260
ClientTop = 3390
ClientWidth = 7530
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5220
ScaleWidth = 7530
Begin VB.CommandButton Cmdexit
Caption = "退出"
Height = 495
Left = 4680
TabIndex = 9
Top = 4560
Width = 955
End
Begin VB.CommandButton Cmdmodify
Caption = "修改"
Default = -1 'True
Height = 495
Left = 1800
TabIndex = 8
Top = 4560
Width = 955
End
Begin VB.Frame Frame2
Height = 855
Left = 120
TabIndex = 19
Top = 4320
Width = 7335
End
Begin VB.Frame Frame1
Height = 4335
Left = 120
TabIndex = 10
Top = 0
Width = 7335
Begin VB.TextBox Text1
Height = 375
Index = 4
Left = 1680
TabIndex = 6
Top = 3360
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Index = 5
Left = 5280
TabIndex = 5
Top = 2280
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Index = 6
Left = 1680
TabIndex = 4
Top = 2280
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Index = 3
Left = 5280
TabIndex = 3
Top = 1440
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Index = 1
Left = 5280
TabIndex = 2
Top = 600
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Index = 2
Left = 1680
TabIndex = 1
Top = 1440
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Index = 0
Left = 1680
TabIndex = 0
Top = 600
Width = 1695
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 5280
TabIndex = 7
Top = 3360
Width = 1695
_ExtentX = 2990
_ExtentY = 661
_Version = 393216
Format = 67698689
CurrentDate = 39373
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "添加日期"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
TabIndex = 18
Top = 3360
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "药品编号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 17
Top = 600
Width = 855
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "药品名称"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 16
Top = 1440
Width = 855
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "药品类型编号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3720
TabIndex = 15
Top = 600
Width = 1335
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "规格"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4440
TabIndex = 14
Top = 1560
Width = 495
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "总规格"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 13
Top = 2280
Width = 735
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "总数量"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4200
TabIndex = 12
Top = 2400
Width = 735
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "价格"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 960
TabIndex = 11
Top = 3360
Width = 495
End
End
End
Attribute VB_Name = "Frm_ypmodify"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmdexit_Click()
Unload Me
End Sub
Private Sub Cmdmodify_Click()
Dim sql As String
Dim mycnn As New ADODB.Connection
If IsNumeric(Text1(0).Text) = False Then
MsgBox "请输入数字!"
Text1(0).SetFocus
Exit Sub
End If
If Text1(0).Text = "" Or Text1(1).Text = "" Or Text1(2).Text = "" Then
MsgBox "重要内容不能为空!"
Text1(0).SetFocus
Exit Sub
End If
c = MsgBox("确认要修改信息吗?")
If c = vbOK Then
mycnn.Open cnn
sql = "update 药品表 set 药品编号 = '" & Text1(0).Text & "', 药品类型名称 = '" & Text1(1).Text & "', 药品名称 = '" & Text1(2).Text & "', 规格 = '" & Text1(3).Text & "', 价格 = " & Val(Text1(4).Text) & " ,总数量 = '" & Text1(5).Text & "',总规格 = '" & Text1(6).Text & "',添加日期 = '" & DTPicker1.Value & "' where 药品编号 = '" & Text1(0).Text & "'"
mycnn.Execute sql
' MsgBox "修改数据成功!"
mycnn.Close
Frm_yplb.Adodc1.Refresh
End If
Unload Me
End Sub
Private Sub Form_Activate()
For i = 0 To 6
Frm_yplb.DataGrid1.Col = i
Text1(i) = Frm_yplb.DataGrid1.Text
Next i
If i = 7 Then
Frm_yplb.DataGrid1.Col = i
DTPicker1 = Frm_yplb.DataGrid1.Text
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -