原文如下:PrivateSubCombo1_Click()SelectCaseCombo1.ListIndexCase0Label1.Caption="请选择日期:"Text1.Visible=FalseDTPicker1.Visible=TrueDTPicker2.Visible=TrueCase1Label1.C...
原文如下:
Private Sub Combo1_Click()
Select Case Combo1.ListIndex
Case 0
Label1.Caption = "请选择日期:"
Text1.Visible = False
DTPicker1.Visible = True
DTPicker2.Visible = True
Case 1
Label1.Caption = "请输入房间号"
Text1.Visible = True
DTPicker1.Visible = False
DTPicker2.Visible = False
End Select
End Sub
Private Sub Command1_Click()
Dim sql As String
Dim rs_find As New ADODB.Recordset
Dim conn As New ADODB.Connection
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\db1.mdb;Persist Security Info=False"
If Label1.Caption = "请选择日期" Then
sql = "select [roomno] as 房间号,ruzhudate as 入住日期,deldate as 退房日期,paymoney as 应付金额 from deluser where deldate between #"
sql = sql & DTPicker1.Value & "# and #" & DTPicker2.Value & "#"
Else
If Label1.Caption = "请输入房间号" Then
sql = "select [roomno] as 房间号,ruzhudate as 入住日期,deldate as 退房日期,paymoney as 应付金额 from deluser where roomno='" & Text1.Text & "' "
End If
End If
rs_find.CursorLocation = adUseClient
rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
Set DataGrid1.DataSource = rs_find
Dim i As Integer
'Dim j As Integer
Dim j As String
'i = DataGrid1.Row
'j = DataGrid1.RecordSelectors
For i = 0 To DataGrid1.Row
'DataGrid1.FirstRow
j = j + DataGrid1.Columns(3)
'DataGrid1.Move
Next i
Text2.Text = j
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.AddItem "按时间段"
Combo1.AddItem "按 房 间"
End Sub
请在今天帮忙解决一下,急用。谢谢
展开