-
October 8th, 2003, 07:14 PM
#1
Member
help, SQL in MS Excel macro
Hi all,
can anyone help me with the following SQL statement pls? here's the code..
Dim strSQL As String
strSQL = "SELECT [StaffInformation].[Name], [AllLeave].[Start_Date], [AllLeave].[End_Date], [AllLeave].[LeaveType], [AllLeave].[CourseName] FROM AllLeave, StaffInformation WHERE [AllLeave].[StaffID] = [StaffInformation].[StaffID] And [AllLeave].[Start_Date] >= '" & Format(DTFrom.Value, "dd-mmm-yyyy") & "' And [AllLeave].[End_Date] <= '" & Format(DTTo.Value, "dd-mmm-yyyy") & "' ORDER BY AllLeave.Start_Date, AllLeave.End_Date, AllLeave.LeaveType"
With Rpt
If .State = adStateOpen Then
.Close
End If
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Open strSQL, DB
MsgBox .RecordCount
End With
Both DTFrom & DTTo are DTPicker component
when i tried that i got error msg
Data type mismatch in criteria expression
can anyone tell me why?
Thanks
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
|
|