?? frmcx.frm
字號:
Left = 3960
TabIndex = 10
Top = 720
Width = 615
End
Begin VB.OptionButton Option1
Caption = "男"
Height = 255
Index = 0
Left = 3240
TabIndex = 9
Top = 720
Value = -1 'True
Width = 615
End
Begin VB.TextBox Text1
Height = 270
Index = 0
Left = 960
TabIndex = 8
Top = 240
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "Email"
Height = 255
Index = 10
Left = 120
TabIndex = 7
Top = 3480
Width = 855
End
Begin VB.CheckBox Check1
Caption = "傳真"
Height = 255
Index = 9
Left = 120
TabIndex = 6
Top = 3120
Width = 735
End
Begin VB.CheckBox Check1
Caption = "性別"
Height = 255
Index = 3
Left = 2400
TabIndex = 5
Top = 720
Width = 735
End
Begin VB.CheckBox Check1
Caption = "昵稱"
Height = 255
Index = 0
Left = 120
TabIndex = 0
Top = 240
Width = 735
End
End
End
Attribute VB_Name = "frmCX"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Check1_Click(Index As Integer)
Dim i As Integer
For i = 0 To 10
Text1(i).Enabled = Check1(i).Value
Next i
'判斷性別輸入是否有效
Option1(0).Enabled = Check1(3).Value
Option1(1).Enabled = Check1(3).Value
'判斷年齡輸入是否有效
Frame2.Enabled = Check1(4).Value
For i = 0 To 1
Check2(i).Enabled = Frame2.Enabled
Next i
End Sub
Private Sub Command1_Click() '模糊查詢
On Error GoTo ErrHandle
'判斷昵稱查詢
If Check1(0).Value = 1 And Not IsNull(Text1(0).Text) Then
SQLadd = SQLadd + " and Love like'*" + Text1(0).Text + "*'"
End If
'判斷QQ查詢
If Check1(1).Value = 1 And Not IsNull(Text1(1).Text) Then
SQLadd = SQLadd + " and Oicq like'*" + Text1(1).Text + "*'"
End If
'判斷姓名查詢
If Check1(2).Value = 1 And Not IsNull(Text1(2).Text) Then
SQLadd = SQLadd + " and Name like'*" + Text1(2).Text + "*'"
End If
'性別查詢
If Check1(3).Value = 1 Then
If Option1(0).Value = True Then
SQLadd = SQLadd + " and Sex='" + "男" + "'"
Else
SQLadd = SQLadd + " and Sex='" + "女" + "'"
End If
End If
'年齡查詢
If Check1(4).Value = 1 Then
If Check2(0).Value = 1 And IsNumeric(Text2(0).Text) Then
If Check2(1).Value = 1 Then
SQLadd = SQLadd + " and Age<=" + Text2(1).Text
SQLadd = SQLadd + " and Age>=" + Text2(0).Text
Else
SQLadd = SQLadd + " and Age>=" + Text2(0).Text
End If
Else
If Check2(1).Value = 1 Then
SQLadd = SQLadd + " and Age<=" + Text2(1).Text
End If
End If
End If
'判斷電話查詢
If Check1(5).Value = 1 And Not IsNull(Text1(5).Text) Then
SQLadd = SQLadd + " and TelepNo like'*" + Text1(5).Text + "*'"
End If
'判斷手機查詢
If Check1(6).Value = 1 And Not IsNull(Text1(6).Text) Then
SQLadd = SQLadd + " and MoveCall like'*" + Text1(6).Text + "*'"
End If
'判斷宅電查詢
If Check1(7).Value = 1 And Not IsNull(Text1(7).Text) Then
SQLadd = SQLadd + " and Home like'*" + Text1(7).Text + "*'"
End If
'判斷傳呼查詢
If Check1(8).Value = 1 And Not IsNull(Text1(8).Text) Then
SQLadd = SQLadd + " and Call like'*" + Text1(8).Text + "*'"
End If
'判斷傳真查詢
If Check1(9).Value = 1 And Not IsNull(Text1(9).Text) Then
SQLadd = SQLadd + " and Fax like'*" + Text1(9).Text + "*'"
End If
'判斷Email查詢
If Check1(10).Value = 1 And Not IsNull(Text1(10).Text) Then
SQLadd = SQLadd + " and Email like'*" + Text1(10).Text + "*'"
End If
'更新數據庫顯示信息
frmData.Data1.DatabaseName = frmData.mdbFile 'App.Path + "\MyNote.mdb"
frmData.Data1.RecordSource = SQLoriginal + SQLadd + SQLorder
frmData.Data1.Refresh
ListRefresh
Unload Me
Exit Sub
ErrHandle:
MsgBox Err.Description
Unload Me
Exit Sub
End Sub
Private Sub Command2_Click() '精確查詢
On Error GoTo ErrHandle
'判斷昵稱查詢
If Check1(0).Value = 1 And Not IsNull(Text1(0).Text) Then
SQLadd = SQLadd + " and Love='" + Text1(0).Text + "'"
End If
'判斷QQ查詢
If Check1(1).Value = 1 And Not IsNull(Text1(1).Text) Then
SQLadd = SQLadd + " and Oicq='" + Text1(1).Text + "'"
End If
'判斷姓名查詢
If Check1(2).Value = 1 And Not IsNull(Text1(2).Text) Then
SQLadd = SQLadd + " and Name='" + Text1(2).Text + "'"
End If
'性別查詢
If Check1(3).Value = 1 Then
If Option1(0).Value = True Then
SQLadd = SQLadd + " and Sex='" + "男" + "'"
Else
SQLadd = SQLadd + " and Sex='" + "女" + "'"
End If
End If
'年齡查詢
If Check1(4).Value = 1 Then
If Check2(0).Value = 1 And IsNumeric(Text2(0).Text) Then
If Check2(1).Value = 1 Then
SQLadd = SQLadd + " and Age<=" + Text2(1).Text
SQLadd = SQLadd + " and Age>=" + Text2(0).Text
Else
SQLadd = SQLadd + " and Age>=" + Text2(0).Text
End If
Else
If Check2(1).Value = 1 Then
SQLadd = SQLadd + " and Age<=" + Text2(1).Text
End If
End If
End If
'判斷電話查詢
If Check1(5).Value = 1 And Not IsNull(Text1(5).Text) Then
SQLadd = SQLadd + " and TelepNo='" + Text1(5).Text + "'"
End If
'判斷手機查詢
If Check1(6).Value = 1 And Not IsNull(Text1(6).Text) Then
SQLadd = SQLadd + " and MoveCall='" + Text1(6).Text + "'"
End If
'判斷宅電查詢
If Check1(7).Value = 1 And Not IsNull(Text1(7).Text) Then
SQLadd = SQLadd + " and Home='" + Text1(7).Text + "'"
End If
'判斷傳呼查詢
If Check1(8).Value = 1 And Not IsNull(Text1(8).Text) Then
SQLadd = SQLadd + " and Call='" + Text1(8).Text + "'"
End If
'判斷傳真查詢
If Check1(9).Value = 1 And Not IsNull(Text1(9).Text) Then
SQLadd = SQLadd + " and Fax='" + Text1(9).Text + "'"
End If
'判斷Email查詢
If Check1(10).Value = 1 And Not IsNull(Text1(10).Text) Then
SQLadd = SQLadd + " and Email='" + Text1(10).Text + "'"
End If
'更新數據庫顯示信息
frmData.Data1.DatabaseName = frmData.mdbFile
frmData.Data1.RecordSource = SQLoriginal + SQLadd + SQLorder
frmData.Data1.Refresh
ListRefresh
Unload Me
Exit Sub
ErrHandle:
MsgBox Err.Description
Unload Me
Exit Sub
End Sub
Private Sub Command3_Click() '取消查詢
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 10
'在不處于查詢狀態時,把文本框設置為失效
Text1(i).Text = ""
Text1(i).Enabled = False
Next i
Option1(0).Enabled = Check1(3).Value
Option1(1).Enabled = Check1(3).Value
'判斷年齡輸入是否有效
Frame2.Enabled = Check1(4).Value
For i = 0 To 1
Check2(i).Enabled = False
Next i
End Sub
Private Sub Check2_Click(Index As Integer)
Text2(Index).Enabled = Check2(Index).Value
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -