这是一个啤酒销售系统的软件
源代码在线查看: frm商品修改.frm
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frm商品修改
Caption = "商品"
ClientHeight = 6270
ClientLeft = 1110
ClientTop = 345
ClientWidth = 5970
LinkTopic = "Form2"
MDIChild = -1 'True
ScaleHeight = 6270
ScaleWidth = 5970
Begin VB.CommandButton Command1
Caption = "``````````"
Height = 375
Left = 4680
TabIndex = 22
Top = 3240
Width = 735
End
Begin MSComDlg.CommonDialog CD1
Left = 4560
Top = 3960
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton C4
Caption = "最后一个"
Height = 375
Left = 4920
TabIndex = 21
Top = 1560
Width = 975
End
Begin VB.CommandButton C3
Caption = "第一个"
Height = 375
Left = 4920
TabIndex = 20
Top = 1200
Width = 975
End
Begin VB.CommandButton C2
Caption = "下一个"
Height = 375
Left = 4920
TabIndex = 19
Top = 840
Width = 975
End
Begin VB.CommandButton C1
Caption = "上一个"
Height = 375
Left = 4920
TabIndex = 18
Top = 480
Width = 975
End
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
Height = 300
Left = 4920
TabIndex = 17
Top = 5160
Width = 975
End
Begin VB.CommandButton cmdUpdate
Caption = "更新(&U)"
Height = 300
Left = 3480
TabIndex = 16
Top = 5175
Width = 975
End
Begin VB.CommandButton cmdRefresh
Caption = "刷新(&R)"
Height = 300
Left = 2400
TabIndex = 15
Top = 5175
Width = 975
End
Begin VB.CommandButton cmdDelete
Caption = "删除(&D)"
Height = 300
Left = 1320
TabIndex = 14
Top = 5175
Width = 975
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
Height = 300
Left = 240
TabIndex = 13
Top = 5175
Width = 975
End
Begin VB.Data Data1
Align = 2 'Align Bottom
Connect = "Access"
DatabaseName = "C:\啤酒数据库\BEER.MDB"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 0
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "商品"
Top = 5925
Visible = 0 'False
Width = 5970
End
Begin VB.TextBox txtFields
DataField = "产品介绍"
DataSource = "Data1"
Height = 405
Index = 5
Left = 1320
MaxLength = 50
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 11
Top = 2520
Width = 3375
End
Begin VB.TextBox txtFields
DataField = "价格"
DataSource = "Data1"
Height = 405
Index = 4
Left = 1320
TabIndex = 9
Top = 2040
Width = 3255
End
Begin VB.TextBox txtFields
DataField = "出品日期"
DataSource = "Data1"
Height = 405
Index = 3
Left = 1320
TabIndex = 7
Top = 1560
Width = 3255
End
Begin VB.TextBox txtFields
DataField = "序列号"
DataSource = "Data1"
Height = 405
Index = 2
Left = 1320
TabIndex = 5
Top = 1080
Width = 3255
End
Begin VB.TextBox txtFields
DataField = "名称"
DataSource = "Data1"
Height = 405
Index = 1
Left = 1320
MaxLength = 50
TabIndex = 3
Top = 600
Width = 3255
End
Begin VB.TextBox txtFields
DataField = "种类"
DataSource = "Data1"
Height = 405
Index = 0
Left = 1320
MaxLength = 10
TabIndex = 1
Top = 120
Width = 3255
End
Begin VB.Image Image1
Height = 1695
Left = 1200
Top = 3240
Width = 3255
End
Begin VB.Label lblLabels
Caption = "图例:"
Height = 255
Index = 6
Left = 360
TabIndex = 12
Top = 3120
Width = 615
End
Begin VB.Label lblLabels
Caption = "产品介绍:"
Height = 255
Index = 5
Left = 360
TabIndex = 10
Top = 2640
Width = 855
End
Begin VB.Label lblLabels
Caption = "价格:"
Height = 255
Index = 4
Left = 360
TabIndex = 8
Top = 2160
Width = 855
End
Begin VB.Label lblLabels
Caption = "出品日期:"
Height = 255
Index = 3
Left = 360
TabIndex = 6
Top = 1680
Width = 975
End
Begin VB.Label lblLabels
Caption = "序列号:"
Height = 255
Index = 2
Left = 360
TabIndex = 4
Top = 1200
Width = 855
End
Begin VB.Label lblLabels
Caption = "名称:"
Height = 255
Index = 1
Left = 360
TabIndex = 2
Top = 720
Width = 735
End
Begin VB.Label lblLabels
Caption = "种类:"
Height = 255
Index = 0
Left = 360
TabIndex = 0
Top = 240
Width = 615
End
End
Attribute VB_Name = "frm商品修改"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdAdd_Click()
Data1.Recordset.AddNew
End Sub
Private Sub cmdDelete_Click()
'如果删除记录集的最后一条记录
'记录或记录集中唯一的记录
Data1.Recordset.Delete
Data1.Recordset.MoveNext
End Sub
Private Sub cmdRefresh_Click()
'这仅对多用户应用程序才是需要的
Data1.Refresh
End Sub
Private Sub cmdUpdate_Click()
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
End Sub
Private Sub c1_Click()
C2.Enabled = True
C4.Enabled = True
If Data1.Recordset.BOF Then
C1.Enabled = False
C3.Enabled = False
C2.SetFocus
Else
Data1.Recordset.MovePrevious
End If
End Sub
Private Sub c2_Click()
C1.Enabled = True
C3.Enabled = True
If Data1.Recordset.EOF Then
C2.Enabled = False
C4.Enabled = False
C1.SetFocus
Else
Data1.Recordset.MoveNext
End If
End Sub
Private Sub c3_Click()
C2.Enabled = True
C4.Enabled = True
Data1.Recordset.MoveFirst
C1.Enabled = False
C3.Enabled = False
End Sub
Private Sub c4_Click()
C1.Enabled = True
C3.Enabled = True
Data1.Recordset.MoveLast
C2.Enabled = False
C4.Enabled = False
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub Command1_Click()
CD1.InitDir = ""
CD1.FileName = ""
CD1.Filter = "pictures (*.bmp;*.ico)| *.bmp;*.ico"
CD1.ShowOpen
Image1.Picture = LoadPicture(CD1.FileName)
End Sub
Private Sub Data1_Error(DataErr As Integer, Response As Integer)
'这就是放置错误处理代码的地方
'如果想忽略错误,注释掉下一行代码
'如果想捕捉错误,在这里添加错误处理代码
MsgBox "数据错误事件命中错误:" & Error$(DataErr)
Response = 0 '忽略错误
End Sub
Private Sub Data1_Reposition()
Screen.MousePointer = vbDefault
On Error Resume Next
'这将显示当前记录位置
'为动态集和快照
Data1.Caption = "记录:" & (Data1.Recordset.AbsolutePosition + 1)
'对于 Table 对象,当记录集创建后并使用下面的行时,
'必须设置 Index 属性
'Data1.Caption = "记录:" & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
End Sub
Private Sub Data1_Validate(Action As Integer, Save As Integer)
'这是放置验证代码的地方
'当下面的动作发生时,调用这个事件
Select Case Action
Case vbDataActionMoveFirst
Case vbDataActionMovePrevious
Case vbDataActionMoveNext
Case vbDataActionMoveLast
Case vbDataActionAddNew
Case vbDataActionUpdate
Case vbDataActionDelete
Case vbDataActionFind
Case vbDataActionBookmark
Case vbDataActionClose
End Select
Screen.MousePointer = vbHourglass
End Sub