📄 findvip.frm
字号:
Top = 1320
Width = 1455
End
Begin VB.OptionButton Option4
Caption = "按加入时间查询"
Height = 255
Left = 1800
TabIndex = 4
Top = 840
Width = 1575
End
Begin VB.OptionButton Option3
Caption = "按级别查询"
Height = 255
Left = 360
TabIndex = 3
Top = 840
Width = 1335
End
Begin VB.OptionButton Option2
Caption = "按姓名查询"
Height = 255
Left = 1800
TabIndex = 2
Top = 360
Width = 1455
End
Begin VB.OptionButton Option1
Caption = "按编号查询"
Height = 255
Left = 360
TabIndex = 1
Top = 360
Width = 1215
End
End
End
Attribute VB_Name = "FindVip"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim SQL As String
If Text1.Text = "" Then
MsgBox "请输入需要查找的关键字!", vbInformation + vbOKOnly, "信息"
Text1.SetFocus
Exit Sub
End If
If Check1.Value = 0 Then
If Option1.Value = True Then
SQL = "select * from vipinfo where 会员ID='" & Text1.Text & "'"
End If
If Option2.Value = True Then
SQL = "select * from vipinfo where 会员姓名='" & Text1.Text & "'"
End If
If Option3.Value = True Then
SQL = "select * from vipinfo where 会员级别='" & Text1.Text & "'"
End If
If Option4.Value = True Then
SQL = "select * from vipinfo where 办理日期=#" & Text1.Text & "#"
End If
ElseIf Check1.Value = 1 Then
If Option1.Value = True Then
SQL = "select * from vipinfo where 会员ID like '%" & Text1.Text & "%'"
End If
If Option2.Value = True Then
SQL = "select * from vipinfo where 会员姓名 like '%" & Text1.Text & "%'"
End If
If Option3.Value = True Then
SQL = "select * from vipinfo where 会员级别 like '%" & Text1.Text & "%'"
End If
If Option4.Value = True Then
SQL = "select * from vipinfo where 办理日期 like '%" & Text1.Text & "%'"
End If
End If
Adodc1.RecordSource = SQL
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
If Adodc1.Recordset.RecordCount <= 0 Then
MsgBox "对不起数据库中没有你需要的信息!", vbInformation + vbOKOnly, "信息"
Text1.Text = ""
Text1.SetFocus
Command3.Enabled = False
Command4.Enabled = False
Command6.Visible = False
Else
Command3.Enabled = True
Command4.Enabled = True
Command6.Visible = True
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text1.SetFocus
Option1.Value = True
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
Check1.Value = 0
End Sub
Private Sub Command3_Click()
If Adodc1.Recordset.RecordCount <= 0 Then
MsgBox "对不起,没有信息可供修改!", vbInformation + vbOKOnly, "信息"
Exit Sub
End If
EditVip.Show vbModal
End Sub
Private Sub Command4_Click()
If Adodc1.Recordset.RecordCount <= 0 Then
MsgBox "对不起,没有信息可供删除!", vbInformation + vbOKOnly, "警告"
Exit Sub
End If
If MDIForm1.MdSet.Visible = False Then
MsgBox "对不起,你不是管理员,无法删除信息!", vbInformation + vbOKOnly, "警告"
Exit Sub
End If
DataGrid1.Col = 0
If MsgBox("你是否确定删除会员ID为“" & DataGrid1.Text & "”的会员信息?", vbInformation + vbYesNo, "是否删除") = vbYes Then
With Adodc1.Recordset
.Delete
End With
MsgBox "信息删除成功,请返回!", vbInformation + vbOKOnly, "提示"
End If
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Command6_Click()
FindVipinfo.Show vbModal
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" _
& App.Path & "\cdlent.mdb;Mode=ReadWrite;Persist Security Info=True;Jet OLEDB:Database Password=vcdglxt"
Adodc1.CursorLocation = adUseClient
Adodc1.CommandType = adCmdText
Command3.Enabled = False
Command4.Enabled = False
Label2.Visible = False
End Sub
Private Sub Option1_Click()
Label1.Caption = "按编号查询"
Text1.SetFocus
Label2.Visible = False
End Sub
Private Sub Option2_Click()
Label1.Caption = "按姓名查询"
Text1.SetFocus
Label2.Visible = False
End Sub
Private Sub Option3_Click()
Label1.Caption = "按级别查询"
Text1.SetFocus
Label2.Visible = False
End Sub
Private Sub Option4_Click()
Label1.Caption = "按时间查询"
Text1.SetFocus
Label2.Visible = True
End Sub
Private Sub Option5_Click()
Dim SQL As String
Label2.Visible = False
SQL = "select * from vipinfo"
Adodc1.RecordSource = SQL
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Command3.Enabled = True
Command4.Enabled = True
Command6.Visible = True
Else
Command3.Enabled = False
Command4.Enabled = False
Command6.Visible = False
End If
End Sub
Private Sub text1_keypress(keyascii As Integer)
If keyascii = "13" And Text1.Text <> "" Then
Dim SQL As String
If Check1.Value = 0 Then
If Option1.Value = True Then
SQL = "select * from vipinfo where 会员ID='" & Text1.Text & "'"
End If
If Option2.Value = True Then
SQL = "select * from vipinfo where 会员姓名='" & Text1.Text & "'"
End If
If Option3.Value = True Then
SQL = "select * from vipinfo where 会员级别='" & Text1.Text & "'"
End If
If Option4.Value = True Then
SQL = "select * from vipinfo where 办理日期=#" & Text1.Text & "#"
End If
ElseIf Check1.Value = 1 Then
If Option1.Value = True Then
SQL = "select * from vipinfo where 会员ID like '%" & Text1.Text & "%'"
End If
If Option2.Value = True Then
SQL = "select * from vipinfo where 会员姓名 like '%" & Text1.Text & "%'"
End If
If Option3.Value = True Then
SQL = "select * from vipinfo where 会员级别 like '%" & Text1.Text & "%'"
End If
If Option4.Value = True Then
SQL = "select * from vipinfo where 办理日期 like '%" & Text1.Text & "%'"
End If
End If
Adodc1.RecordSource = SQL
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
If Adodc1.Recordset.RecordCount <= 0 Then
MsgBox "对不起数据库中没有你需要的信息!", vbInformation + vbOKOnly, "信息"
Text1.Text = ""
Text1.SetFocus
Command3.Enabled = False
Command4.Enabled = False
Command6.Visible = False
Else
Command3.Enabled = True
Command4.Enabled = True
Command6.Visible = True
End If
ElseIf keyascii = "13" And Text1.Text = "" Then
MsgBox "请输入需要查找的关键字!", vbInformation + vbOKOnly, "信息"
Text1.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -