|
-
Sep 8th, 2008, 03:22 PM
#34
Thread Starter
Member
Re: Database application query problem
Thanks for your reply and for the links, This is my current code:
Code:
rs1.Open "CL1", ds1, adOpenDynamic, adLockOptimistic
que = "SELECT DateDiff('h',0,Sum(end_time-call_in)) & Format(Sum(end_time-call_in), ':nn:ss') as TotalTime "
que = que + "From CL1 WHERE call_in Between #" + Trim(Text1.Text) + "# and #" + Trim(Text2.Text) + "#"
que = que & " AND Format(call_in,'w') NOT IN(1,7) "
que = que & " AND Int(call_in) NOT IN"
If (List1.ListCount = 1) Then
que = que & "(" & Int(CDate(List1.List(iloop))) & ") "
Else
For iloop = 0 To List1.ListCount - 1
TempArray() = Split(List1.List(iloop), "/")
MyDate = DateSerial(TempArray(2), TempArray(0), TempArray(1))
If (iloop = List1.ListCount - 1) Then
que = que & " " & Int(MyDate) & ") "
Else
If (iloop > 0) Then
que = que & " " & Int(MyDate) & ", "
Else
que = que & " (" & Int(MyDate) & ", "
End If
End If
Next iloop
End If
que = que & " AND end_time Is Not Null;"
Set rs1 = ds1.Execute(que)
MSFlexGrid1.TextMatrix(1, 5) = rs1("TotalTime").Value
Text4.Text = que
The query now has no errors but the outcome is the same as the result of excluding weekends(the section for excluding dates is not effective even though it looks correct). Dunno where is it wrong?
The query on running looks like:
SELECT DateDiff('h',0,Sum(end_time-call_in)) & Format(Sum(end_time-call_in), ':nn:ss') as TotalTime From CL1 WHERE call_in Between #08/01/2008# and #08/31/2008# AND Format(call_in,'w') NOT IN(1,7) AND Int(call_in) NOT IN (8/28/2008, 8/29/2008, 8/22/2008, 8/21/2008) AND end_time Is Not Null;
Thanks
Last edited by cool11; Sep 8th, 2008 at 03:27 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|