📄 frmcust.frm
字号:
Width = 975
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "联系电话"
Height = 255
Left = 480
TabIndex = 18
Top = 2280
Width = 975
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "余 额"
Height = 255
Left = 5520
TabIndex = 16
Top = 1800
Width = 855
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "邮 编"
Height = 255
Left = 3000
TabIndex = 14
Top = 1800
Width = 855
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "出生日期"
Height = 255
Left = 480
TabIndex = 12
Top = 1800
Width = 975
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "光顾次数"
Height = 255
Left = 5520
TabIndex = 10
Top = 1320
Width = 975
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "性 别"
Height = 255
Left = 3000
TabIndex = 9
Top = 1320
Width = 975
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "身 份 证"
Height = 255
Left = 480
TabIndex = 7
Top = 1320
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "光顾时间"
Height = 255
Left = 5520
TabIndex = 5
Top = 840
Width = 1095
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "顾客姓名"
Height = 255
Left = 3000
TabIndex = 3
Top = 840
Width = 1095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "顾客编号"
Height = 255
Left = 480
TabIndex = 1
Top = 840
Width = 1215
End
End
Begin MSAdodcLib.Adodc AdoCust
Height = 270
Left = 3480
Top = 3600
Width = 2040
_ExtentX = 3598
_ExtentY = 476
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 0
BackColor = -2147483647
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Password=624813;Persist Security Info=True;User ID=xt;Initial Catalog=xt;Data Source=XT"
OLEDBString = "Provider=SQLOLEDB.1;Password=624813;Persist Security Info=True;User ID=xt;Initial Catalog=xt;Data Source=XT"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from Cust_Info"
Caption = "顾客信息"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "frmCust"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_Addnew_Click()
Dim T As Integer
On Error Resume Next
Frame1.Enabled = True
Cmd_Save.Enabled = True
Cmd_Addnew.Enabled = False
Cmd_Del.Enabled = False
Cmd_Update.Enabled = False
Cmd_Search.Enabled = False
AdoCust.Recordset.MoveLast
T = AdoCust.Recordset.Fields("ID")
AdoCust.Recordset.AddNew
Text1.Text = T + 1
Text2.SetFocus
End Sub
Private Sub Cmd_Cancel_Click()
Unload frmCust
End Sub
Private Sub Cmd_Del_Click()
On Error Resume Next
I = MsgBox("如果现在删除这个顾客,以后将无法恢复,你确定要删除吗?", vbOKCancel + vbQuestion, "请注意!")
If I = 1 Then
AdoCust.Recordset.Delete
AdoCust.Refresh
AdoCust.Recordset.MoveNext
If AdoCust.Recordset.EOF Then
AdoCust.Recordset.MoveLast
End If
End If
End Sub
Private Sub Cmd_Save_Click()
AdoCust.Recordset.Update
AdoCust.Refresh
Frame1.Enabled = False
Cmd_Addnew.Enabled = True
Cmd_Del.Enabled = True
Cmd_Update.Enabled = True
Cmd_Search.Enabled = True
End Sub
Private Sub Cmd_Search_Click()
If AdoCust.Recordset.EOF = True Then
MsgBox "无任何记录可以查询"
Else
AdoCust.Recordset.MoveFirst
Dim CustID As Integer
Dim CustName As String
CustID = IIf(Trim(Text13.Text) = "", 0, Trim(Text13.Text))
CustName = Trim(Text14.Text)
If CustID = 0 And CustName = "" Then
MsgBox "你没有输入任何查询条件", vbOKOnly + vbCritical, "错误"
ElseIf CustID = 0 Then
AdoCust.Recordset.Find " Name='" & CustName & "'"
ElseIf CustName = "" Then
AdoCust.Recordset.Find " ID='" & CustID & "'"
Else
AdoCust.Recordset.Find " ID='" & CustID & "'"
If AdoCust.Recordset.EOF = True Then
AdoCust.Recordset.Find " Name='" & CustName & "'"
If AdoCust.Recordset.EOF = True Then
MsgBox "没有找到此顾客"
End If
End If
End If
Text13.Text = ""
Text14.Text = ""
If AdoCust.Recordset.EOF = True Then
MsgBox "没有找到此顾客"
AdoCust.Recordset.MoveFirst
Text1.Text = ""
Text2.Text = ""
End If
End If
End Sub
Private Sub Cmd_Update_Click()
On Error Resume Next
Frame1.Enabled = True
Cmd_Update.Enabled = False
Cmd_Save.Enabled = True
Cmd_Del.Enabled = False
Cmd_Addnew.Enabled = False
Cmd_Search.Enabled = False
Text1.SetFocus
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Cmd_Addnew.Enabled = False Or Cmd_Update.Enabled = False Then
I = MsgBox("数据没有存盘,要存盘吗?", vbOKCancel + vbQuestion, "请注意!")
End If
If I = 1 Then
AdoCust.Recordset.Update
Unload frmCust
Else
Unload frmCust
End If
End Sub
Private Sub Form_Load()
If Limit = "5" Then
Me.Cmd_Addnew.Enabled = False
Me.Cmd_Del.Enabled = False
Me.Cmd_Update.Enabled = False
End If
End Sub
Private Sub Text3_GotFocus()
If Me.Cmd_Addnew.Enabled = False Then
Text3.Text = Date
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -