Dim a As String
Private Sub Combo1_Click()
If Combo1.ListIndex = 0 Then
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = False
Combo3.Enabled = False
ElseIf Combo1.ListIndex = 1 Then
Text3.Enabled = True
Text1.Enabled = False
Text2.Enabled = False
Combo3.Enabled = False
ElseIf Combo1.ListIndex = 2 Then
Combo3.Enabled = True
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
End IfEnd SubPrivate Sub Command1_Click()
If Combo1.ListIndex = -1 Then
MsgBox "请éæ©æ¥è¯¢æ¹å¼", , "æ示"
ElseIf Combo1.ListIndex = 0 Then
Adodc1.CommandType = adCmdUnknown
If Text2.Text = "" Then
MsgBox "æ¥è¯¢èå´ä¸éä¸å¯ä¸ºç©º", , "æ示"
Else
Adodc1.RecordSource = "select * from åºæ¬ä¿¡æ¯ where å¹´é¾>= " & Text1.Text & " and å¹´é¾<= " & Text2.Text & " "
Adodc1.Refresh
End If
ElseIf Combo1.ListIndex = 1 Then
Adodc1.CommandType = adCmdUnknown
If Text3.Text = "" Then
MsgBox "ç¡®å®å
容为空ï¼"
Adodc1.RecordSource = "select*from åºæ¬ä¿¡æ¯ where å¦å·='" & Text3.Text & "'"
Adodc1.Refresh
Else
Adodc1.RecordSource = "select*from åºæ¬ä¿¡æ¯ where å¦å·='" & Text3.Text & "'"
Adodc1.Refresh
End If
ElseIf Combo1.ListIndex = 2 Then
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from åºæ¬ä¿¡æ¯ where ä¸ä¸='" & Combo3.Text & "' "
Adodc1.Refresh
End IfEnd SubPrivate Sub Command2_Click()
Adodc1.Recordset.AddNew
End SubPrivate Sub Command3_Click()
Adodc1.Recordset.Delete
End SubPrivate Sub Command4_Click()
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from åºæ¬ä¿¡æ¯"
Adodc1.Refresh
End SubPrivate Sub Command5_Click()
a = InputBox("请è¾å
¥æ¥è¯¢å¯¹è±¡å段", "èªå®ä¹æ¥è¯¢")
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select*from åºæ¬ä¿¡æ¯ where a"
Adodc1.Refresh
End SubPrivate Sub Form_Load()
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" + App.Path + "\" + "å¦çæ°æ®åº.mdb"
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from åºæ¬ä¿¡æ¯"
Adodc1.Refresh
End Sub
温馨提示:答案为网友推荐,仅供参考