⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu21.frm

📁 给售房作的,但还没有全完成,最好是只看看里面有用的东东就可以了
💻 FRM
字号:
VERSION 5.00
Begin VB.Form winmenu21 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "售房管理  查询"
   ClientHeight    =   4530
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6540
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4530
   ScaleWidth      =   6540
   Begin VB.Frame Frame2 
      Caption         =   "按下列条件查找房间"
      Height          =   2415
      Left            =   120
      TabIndex        =   14
      Top             =   120
      Width           =   6255
      Begin VB.CommandButton newcondition 
         Caption         =   "新搜索条件"
         Height          =   375
         Left            =   4320
         TabIndex        =   17
         Top             =   1920
         Width           =   1455
      End
      Begin VB.CommandButton delcondition 
         Caption         =   "删    除"
         Height          =   375
         Left            =   2640
         TabIndex        =   16
         Top             =   1920
         Width           =   1455
      End
      Begin VB.ListBox conditionl 
         Height          =   1500
         Left            =   240
         TabIndex        =   15
         Top             =   240
         Width           =   5775
      End
   End
   Begin VB.CommandButton opencondition 
      Caption         =   "打开搜索条件"
      Height          =   375
      Left            =   4800
      TabIndex        =   12
      Top             =   4080
      Width           =   1335
   End
   Begin VB.CommandButton savecondition 
      Caption         =   "保存搜索条件"
      Enabled         =   0   'False
      Height          =   375
      Left            =   3240
      TabIndex        =   11
      Top             =   4080
      Width           =   1335
   End
   Begin VB.CommandButton cancelme 
      Caption         =   "取    消"
      Height          =   375
      Left            =   1800
      TabIndex        =   10
      Top             =   4080
      Width           =   1215
   End
   Begin VB.CommandButton startcondition 
      Caption         =   "开始查找"
      Enabled         =   0   'False
      Height          =   375
      Left            =   360
      TabIndex        =   9
      Top             =   4080
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "定义多重条件"
      Height          =   1215
      Left            =   120
      TabIndex        =   0
      Top             =   2640
      Width           =   6255
      Begin VB.CommandButton appcondition 
         Caption         =   "添  至  列  表"
         Enabled         =   0   'False
         Height          =   375
         Left            =   4320
         TabIndex        =   13
         Top             =   240
         Width           =   1815
      End
      Begin VB.OptionButton con1 
         Caption         =   "与"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   600
         Width           =   495
      End
      Begin VB.TextBox value1 
         Height          =   270
         Left            =   3600
         MaxLength       =   7
         TabIndex        =   7
         ToolTipText     =   "只允许输入数字与小数点"
         Top             =   720
         Width           =   2295
      End
      Begin VB.ComboBox condition 
         Height          =   300
         Left            =   2160
         TabIndex        =   5
         Top             =   720
         Width           =   1335
      End
      Begin VB.ComboBox proper 
         Height          =   300
         Left            =   720
         TabIndex        =   3
         ToolTipText     =   "sss"
         Top             =   720
         Width           =   1335
      End
      Begin VB.OptionButton con2 
         Caption         =   "或"
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   840
         Value           =   -1  'True
         Width           =   615
      End
      Begin VB.Label Label5 
         Caption         =   "取值:"
         Height          =   255
         Left            =   3720
         TabIndex        =   8
         Top             =   480
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "条件:"
         Height          =   255
         Left            =   2280
         TabIndex        =   6
         Top             =   480
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "属性:"
         Height          =   255
         Left            =   840
         TabIndex        =   4
         Top             =   480
         Width           =   855
      End
   End
End
Attribute VB_Name = "winmenu21"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim querykk As Database
Dim querytab As Recordset
Public returnname As String
Private Sub appcondition_Click()
If conditionl.ListCount >= 8 Then MsgBox "复合条件不能超过八个!", vbOKOnly + vbExclamation, "金风售房管理系统 ": delcondition.SetFocus: conditionl.ListIndex = 0: Exit Sub

If proper.Text = "" Then If condition.Text = "" Then MsgBox "条件运算符不能为空!", vbOKOnly + vbExclamation, "金风售房管理系统 ": Exit Sub
If value1.Text = "" Then MsgBox "值不能为空!", vbOKOnly + vbExclamation, "金风售房管理系统 ": Exit Sub
If proper.Text = "房屋类型" Then If condition.Text <> "等于" Then MsgBox "房屋类型的条件运算符只能为等于!", vbOKOnly + vbExclamation, "金风售房管理系统 ":              condition.Text = "等于"
If proper.Text = "户位" Then If condition.Text <> "等于" Then MsgBox "户位的条件运算符只能为等于!", vbOKOnly + vbExclamation, "金风售房管理系统 ":              condition.Text = "等于"
If proper.Text = "房屋类型" Then If value1.Text <> "0" And value1.Text <> "1" Then MsgBox "取值超出范围(0或1)!", vbOKOnly + vbExclamation, "金风售房管理系统 ": value1.Text = "": Exit Sub
If proper.Text = "户位" Then If value1.Text <> "1" And value1.Text <> "2" And value1.Text <> "3" Then MsgBox "取值超出范围(1、2或3)!", vbOKOnly + vbExclamation, "金风售房管理系统 ": value1.Text = "": Exit Sub
con = ""
If conditionl.ListCount > 0 Then If con1.Value = True Then con = "与 " Else con = "或 "
conditionl.AddItem con + proper.Text + " " + condition.Text + " " + value1.Text + " "
value1.Text = ""
appcondition.Enabled = False
proper.SetFocus
If conditionl.ListCount = 1 Then startcondition.Enabled = True: savecondition.Enabled = True
End Sub

Private Sub Command3_Click()
ss = InputBox("请为此搜索条件命名:", "保存搜索条件", "条件1")
End Sub

Private Sub cancelme_Click()
Unload Me
End Sub

Private Sub condition_KeyPress(KeyAscii As Integer)
KeyAscii = 0

End Sub
Private Sub delcondition_Click()
If conditionl.ListCount = 0 Then Exit Sub
conditionl.RemoveItem conditionl.ListIndex
If conditionl.ListCount = 0 Then startcondition.Enabled = False: savecondition.Enabled = False
End Sub

Private Sub Form_Activate()
If returnname <> "" Then
   Set querytab = querykk.OpenRecordset("select * from query where name='" + returnname + "' ")
   conditionl.Clear
   If querytab("content1") <> " " Then conditionl.AddItem querytab("content1")
   If querytab("content2") <> " " Then conditionl.AddItem querytab("content2")
   If querytab("content3") <> " " Then conditionl.AddItem querytab("content3")
   If querytab("content4") <> " " Then conditionl.AddItem querytab("content4")
   If querytab("content5") <> " " Then conditionl.AddItem querytab("content5")
   If querytab("content6") <> " " Then conditionl.AddItem querytab("content6")
   If querytab("content7") <> " " Then conditionl.AddItem querytab("content7")
   If querytab("content8") <> " " Then conditionl.AddItem querytab("content8")
   returnname = ""
   startcondition.Enabled = True
   savecondition.Enabled = True
End If
End Sub

Private Sub Form_Load()
Set querykk = OpenDatabase(App.Path + "\sfgl.mdb")
winmenu21.Left = 1800
winmenu21.Top = 600
proper.AddItem "楼号"
proper.AddItem "楼层"
proper.AddItem "单元"
proper.AddItem "面积"
proper.AddItem "单价"
proper.AddItem "户位"
proper.AddItem "房屋类型"
proper.ListIndex = 0
 
condition.AddItem "等于"
condition.AddItem "大于"
condition.AddItem "小于"
condition.ListIndex = 0
End Sub

Private Sub newcondition_Click()
conditionl.Clear
startcondition.Enabled = False
savecondition.Enabled = False
End Sub

Private Sub opencondition_Click()
Set querytab = querykk.OpenRecordset("query")
If querytab.EOF Then MsgBox "没有可打开的搜索条件!" + Chr(13) + "您必须先保存一个搜索条件才能作此操作!", vbOKOnly + vbExclamation, "金风售房管理系统 ": Exit Sub

winmenu21.Enabled = False
winmenu211.Show
winmenu211.Height = 3030
winmenu211.Width = 6630
End Sub

Private Sub proper_Click()
Select Case proper.Text
    Case "楼号"
       proper.ToolTipText = "输入要查找楼房是第几栋"
    Case "单价"
       proper.ToolTipText = "价格单位为:元/平方米"
    Case "房屋类型"
       proper.ToolTipText = "代码为0:住房1:店铺"
    Case "户位"
       proper.ToolTipText = "代码为1:左户2:中户3:右户"
    Case Else
       proper.ToolTipText = ""
End Select
    
End Sub

Private Sub proper_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub

Private Sub savecondition_Click()
name:
savecon = InputBox("请为此搜索条件命名(只保留十位):", "保存搜索条件")
If savecon = "" Then Exit Sub
savecon = LeftB(savecon, 20)
conditionl.ListIndex = 0
s1 = conditionl.Text
If conditionl.ListCount > 1 Then conditionl.ListIndex = 1: s2 = conditionl.Text Else s2 = " "
If conditionl.ListCount > 2 Then conditionl.ListIndex = 2: s3 = conditionl.Text Else s3 = " "
If conditionl.ListCount > 3 Then conditionl.ListIndex = 3: s4 = conditionl.Text Else s4 = " "
If conditionl.ListCount > 4 Then conditionl.ListIndex = 4: s5 = conditionl.Text Else s5 = " "
If conditionl.ListCount > 5 Then conditionl.ListIndex = 5: s6 = conditionl.Text Else s6 = " "
If conditionl.ListCount > 6 Then conditionl.ListIndex = 6: s7 = conditionl.Text Else s7 = " "
If conditionl.ListCount > 7 Then conditionl.ListIndex = 7: s8 = conditionl.Text Else s8 = " "
Set querytab = querykk.OpenRecordset("select * from query where name='" + savecon + "'")
If Not querytab.EOF Then
   yn = MsgBox("是否要替换原来存过的" + savecon + "条件", vbYesNo + vbQuestion, "金风售房管理系统")
   If yn = vbYes Then querykk.Execute "delete * from query where name='" + savecon + "' " Else GoTo name:
End If
querykk.Execute "insert into  query (name,content1,content2,content3,content4,content5,content6,content7,content8) values ('" + savecon + "','" + s1 + "','" + s2 + "','" + s3 + "','" + s4 + "','" + s5 + "','" + s6 + "','" + s7 + "','" + s8 + "')"
End Sub

Private Sub startcondition_Click()
   MousePointer = vbHourglass

End Sub

Private Sub value1_Change()
If value1.Text <> "" Then appcondition.Enabled = True Else appcondition.Enabled = False
End Sub

Private Sub value1_KeyPress(KeyAscii As Integer)
Static point As Boolean
'用于控制小数点只允许输入一次,boolean型初始定义时值为false
'所以当输入过小数点之后置值为true,表示小数点输入过了
If Not point Then
   If KeyAscii < 48 Or KeyAscii > 57 Then If KeyAscii <> 8 Then If KeyAscii <> 46 Then KeyAscii = 0
Else
   If KeyAscii < 48 Or KeyAscii > 57 Then If KeyAscii <> 8 Then KeyAscii = 0
End If
If KeyAscii = 46 Then point = True
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -